Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Table(name = "CHANNEL")
- public class Channel {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int id;
- @Column
- private String channelName;
- @ElementCollection
- private List<String> channelType = new ArrayList<String>();
- @Column
- private String description;
- //Getters and setters
- @RunWith(SpringJUnit4ClassRunner.class)
- @ContextConfiguration(locations = { "classpath:spring-servlet.xml" })
- @TransactionConfiguration(defaultRollback = true)
- public class ChannelServiceTest {
- @Autowired
- private ChannelService channelService;
- public void setChannelService(ChannelService channelService) {
- this.channelService = channelService;
- }
- @Test
- public void testSaveMethod() {
- Channel channel = new Channel();
- channel.setChannelName("HBO");
- channel.setChannelType(Arrays.asList("MOVIES", "NEWS"));
- channel.setDescription("This is the description");
- try {
- channelService.saveChannel(channel);
- } catch (ServiceException e) {
- e.printStackTrace();
- Assert.fail("Save didn't pass");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement