@Test public void findJudgment_metadataError() { String judgmentId = "4214"; String errorResponseMetadata = "<?xml version=\"1.0\"?><error>Judgement with specified id (152500000000503_I_ACa_001011_2013_Uz_2014-02-05_0012) not found.</error>"; String metadataUrl = "http: Mockito.when(urlFactory.createSourceJudgmentDetailsUrl(Mockito.eq(judgmentId))).thenReturn(metadataUrl); mockServerSuccessResponse(metadataUrl, errorResponseMetadata, MediaType.TEXT_HTML); CatchExceptionAssertJ.when(sourceCcjExternalRepository).findJudgment(judgmentId); CatchExceptionAssertJ.then(CatchException.caughtException()) .isExactlyInstanceOf(SourceCcJudgmentDownloadErrorException.class) .hasMessageContaining(errorResponseMetadata); }
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);  }