@Test(expected = DataIntegrityViolationException.class) @Override public void testDuplicateCreate() { // violates messageid-deliverer constraint final MessageDelivery md = new MessageDelivery(); md.setId(KCBTestData.FAKE_ID); md.setDelivererSystemId(MESSAGE_DELIV.getDelivererSystemId()); md.setDelivererTypeName(MESSAGE_DELIV.getDelivererTypeName()); md.setDeliveryStatus(MESSAGE_DELIV.getDeliveryStatus()); md.setLockVerNbr(MESSAGE_DELIV.getLockVerNbr()); md.setMessage(MESSAGE); messageDeliveryService.saveMessageDelivery(md); }
@Override public void setUp() throws Exception { super.setUp(); messageService = GlobalKCBServiceLocator.getInstance().getMessageService(); messageDeliveryService = GlobalKCBServiceLocator.getInstance().getMessageDeliveryService(); MESSAGE = KCBTestData.getMessage1(); messageService.saveMessage(MESSAGE); MESSAGE_DELIV = KCBTestData.getMessageDelivery1(); MESSAGE_DELIV.setMessage(MESSAGE); messageDeliveryService.saveMessageDelivery(MESSAGE_DELIV); }
@Test @Override public void testCreate() { MessageDelivery md = new MessageDelivery(); md.setDelivererTypeName("pigeon"); md.setMessage(MESSAGE); messageDeliveryService.saveMessageDelivery(md); assertNotNull(md.getId()); Collection<MessageDelivery> ms = messageDeliveryService.getAllMessageDeliveries(); assertNotNull(ms); assertEquals(2, ms.size()); MessageDelivery md2 = messageDeliveryService.getMessageDelivery(md.getId()); assertNotNull(md2); assertEqualsMD(md, md2); }