Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. @Entity
  2. @Table(name = "CHANNEL")
  3. public class Channel {
  4. @Id
  5. @GeneratedValue(strategy = GenerationType.IDENTITY)
  6. private int id;
  7.  
  8. @Column
  9. private String channelName;
  10.  
  11. @ElementCollection
  12. private List<String> channelType = new ArrayList<String>();
  13.  
  14. @Column
  15. private String description;
  16. //Getters and setters
  17.  
  18. @RunWith(SpringJUnit4ClassRunner.class)
  19. @ContextConfiguration(locations = { "classpath:spring-servlet.xml" })
  20. @TransactionConfiguration(defaultRollback = true)
  21. public class ChannelServiceTest {
  22.  
  23. @Autowired
  24. private ChannelService channelService;
  25.  
  26. public void setChannelService(ChannelService channelService) {
  27. this.channelService = channelService;
  28. }
  29.  
  30. @Test
  31. public void testSaveMethod() {
  32. Channel channel = new Channel();
  33. channel.setChannelName("HBO");
  34. channel.setChannelType(Arrays.asList("MOVIES", "NEWS"));
  35. channel.setDescription("This is the description");
  36.  
  37. try {
  38. channelService.saveChannel(channel);
  39. } catch (ServiceException e) {
  40. e.printStackTrace();
  41. Assert.fail("Save didn't pass");
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement