@Test public void testIsApplicableToProducerTrue() throws Exception { when(userReferenceUpdateXpathExtractor.getNewUserRefDescr(any(Node.class))) .thenReturn(XPathString.valueOf(USER_REF_DESCR)); Boolean isApplicable = userReferenceDescriptionUpdateProducer.isApplicable(userRefDescrDoc); assertTrue(isApplicable); }
@Test public void testCreateApplicableEvent() throws Exception { when(userReferenceUpdateXpathExtractor.getNewUserRefDescr(any(Node.class))) .thenReturn(XPathString.valueOf(USER_REF_DESCR)); when(userReferenceUpdateXpathExtractor.getOldSusbcrId(any(Node.class))) .thenReturn(XPathLong.valueOf(SUBSCRIPTION_ID)); when(userReferenceUpdateXpathExtractor.getOldNumberTypeId(any(Node.class))) .thenReturn(XPathString.valueOf(NUMBER_TYPE)); UserReferenceDescriptionUpdateEvent userReferenceDescrUpdateEvent = (UserReferenceDescriptionUpdateEvent) (userReferenceDescriptionUpdateProducer.produceMessage(userRefDescrDoc)).get(0); assertEquals( "Unextected User Reference Descr", USER_REF_DESCR, userReferenceDescrUpdateEvent.getUserRefDescr()); assertEquals( "Unextected SubscriptionId", SUBSCRIPTION_ID, userReferenceDescrUpdateEvent.getDomainId()); }
@Test public void testIsApplicableToProducerFalse() throws Exception { when(userReferenceUpdateXpathExtractor.getNewUserRefDescr(any(Node.class))).thenReturn(null); Boolean isApplicable = userReferenceDescriptionUpdateProducer.isApplicable(invoiceRefDoc); assertFalse(isApplicable); }