@Test public void findJudgment() { String judgmentId = "XXX-111223"; String responseMetadata = "<id>111</id><id>222</id>"; String responseContent = "W imieniu Rzeczypospolitej..."; String metadataUrl = "http: String contentUrl = "http: Mockito.when(urlFactory.createSourceJudgmentDetailsUrl(Mockito.eq(judgmentId))).thenReturn(metadataUrl); Mockito.when(urlFactory.createSourceJudgmentContentUrl(Mockito.eq(judgmentId))).thenReturn(contentUrl); mockServerSuccessResponse(metadataUrl, responseMetadata, MediaType.TEXT_XML); mockServerSuccessResponse(contentUrl, responseContent, MediaType.TEXT_XML); SourceCcJudgmentTextData ccJudgmentTextData = sourceCcjExternalRepository.findJudgment(judgmentId); assertEquals(responseMetadata, ccJudgmentTextData.getMetadata()); assertEquals(responseContent, ccJudgmentTextData.getContent()); assertEquals(metadataUrl, ccJudgmentTextData.getMetadataSourceUrl()); assertEquals(contentUrl, ccJudgmentTextData.getContentSourceUrl()); mockServer.verify(); }
public SourceCcJudgmentTextData findJudgment(String judgmentId) { SourceCcJudgmentTextData sourceCcJudgmentTextData = new SourceCcJudgmentTextData(); sourceCcJudgmentTextData.setMetadata(findJudgmentDetails(judgmentId)); sourceCcJudgmentTextData.setMetadataSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentDetailsUrl(judgmentId)); sourceCcJudgmentTextData.setContent(findJudgmentContent(judgmentId)); sourceCcJudgmentTextData.setContentSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentContentUrl(judgmentId)); return sourceCcJudgmentTextData; }
SourceCcjExternalRepository { public SourceCcJudgmentTextData findJudgment(String judgmentId) { SourceCcJudgmentTextData sourceCcJudgmentTextData = new SourceCcJudgmentTextData(); sourceCcJudgmentTextData.setMetadata(findJudgmentDetails(judgmentId)); sourceCcJudgmentTextData.setMetadataSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentDetailsUrl(judgmentId)); sourceCcJudgmentTextData.setContent(findJudgmentContent(judgmentId)); sourceCcJudgmentTextData.setContentSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentContentUrl(judgmentId)); return sourceCcJudgmentTextData; } }
SourceCcjExternalRepository { public SourceCcJudgmentTextData findJudgment(String judgmentId) { SourceCcJudgmentTextData sourceCcJudgmentTextData = new SourceCcJudgmentTextData(); sourceCcJudgmentTextData.setMetadata(findJudgmentDetails(judgmentId)); sourceCcJudgmentTextData.setMetadataSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentDetailsUrl(judgmentId)); sourceCcJudgmentTextData.setContent(findJudgmentContent(judgmentId)); sourceCcJudgmentTextData.setContentSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentContentUrl(judgmentId)); return sourceCcJudgmentTextData; }  }
SourceCcjExternalRepository { public SourceCcJudgmentTextData findJudgment(String judgmentId) { SourceCcJudgmentTextData sourceCcJudgmentTextData = new SourceCcJudgmentTextData(); sourceCcJudgmentTextData.setMetadata(findJudgmentDetails(judgmentId)); sourceCcJudgmentTextData.setMetadataSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentDetailsUrl(judgmentId)); sourceCcJudgmentTextData.setContent(findJudgmentContent(judgmentId)); sourceCcJudgmentTextData.setContentSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentContentUrl(judgmentId)); return sourceCcJudgmentTextData; }  List<String> findJudgmentIds(int pageNo, int pageSize, DateTime publicationDateFrom); SourceCcJudgmentTextData findJudgment(String judgmentId); @Autowired void setXmlTagContentExtractor(XmlTagContentExtractor xmlTagContentExtractor); @Autowired void setRestTemplate(RestTemplate restTemplate); @Autowired void setSourceCcJudgmentUrlFactory(SourceCcJudgmentUrlFactory sourceCcJudgmentUrlFactory); }
SourceCcjExternalRepository { public SourceCcJudgmentTextData findJudgment(String judgmentId) { SourceCcJudgmentTextData sourceCcJudgmentTextData = new SourceCcJudgmentTextData(); sourceCcJudgmentTextData.setMetadata(findJudgmentDetails(judgmentId)); sourceCcJudgmentTextData.setMetadataSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentDetailsUrl(judgmentId)); sourceCcJudgmentTextData.setContent(findJudgmentContent(judgmentId)); sourceCcJudgmentTextData.setContentSourceUrl(sourceCcJudgmentUrlFactory.createSourceJudgmentContentUrl(judgmentId)); return sourceCcJudgmentTextData; }  List<String> findJudgmentIds(int pageNo, int pageSize, DateTime publicationDateFrom); SourceCcJudgmentTextData findJudgment(String judgmentId); @Autowired void setXmlTagContentExtractor(XmlTagContentExtractor xmlTagContentExtractor); @Autowired void setRestTemplate(RestTemplate restTemplate); @Autowired void setSourceCcJudgmentUrlFactory(SourceCcJudgmentUrlFactory sourceCcJudgmentUrlFactory);  }