@Test public void enrich_Judgment_TagsFound() { EnrichmentTag enrichmentTag1 = new EnrichmentTag(); enrichmentTag1.setTagType("TAG_TYPE_1"); EnrichmentTag enrichmentTag2 = new EnrichmentTag(); enrichmentTag1.setTagType("TAG_TYPE_2"); when(enrichmentTagRepository.findAllByJudgmentId(judgment.getId())).thenReturn(Lists.newArrayList(enrichmentTag1, enrichmentTag2)); EnrichmentTagApplier enrichmentTagApplier1 = mock(EnrichmentTagApplier.class); when(enrichmentTagApplierManager.getEnrichmentTagApplier(enrichmentTag1.getTagType())).thenReturn(enrichmentTagApplier1); EnrichmentTagApplier enrichmentTagApplier2 = mock(EnrichmentTagApplier.class); when(enrichmentTagApplierManager.getEnrichmentTagApplier(enrichmentTag2.getTagType())).thenReturn(enrichmentTagApplier2); judgmentEnrichmentService.enrich(judgment); verifyZeroInteractions(judgmentRepository, entityManager); verify(enrichmentTagApplierManager).getEnrichmentTagApplier(enrichmentTag1.getTagType()); verify(enrichmentTagApplierManager).getEnrichmentTagApplier(enrichmentTag2.getTagType()); verify(enrichmentTagApplier1).applyEnrichmentTag(judgment, enrichmentTag1); verify(enrichmentTagApplier2).applyEnrichmentTag(judgment, enrichmentTag2); }
public <T extends Judgment> void enrich(T judgment) { Preconditions.checkNotNull(judgment); List<EnrichmentTag> enrichmentTags = enrichmentTagRepository.findAllByJudgmentId(judgment.getId()); enrich(judgment, enrichmentTags); }
JudgmentEnrichmentService { public <T extends Judgment> void enrich(T judgment) { Preconditions.checkNotNull(judgment); List<EnrichmentTag> enrichmentTags = enrichmentTagRepository.findAllByJudgmentId(judgment.getId()); enrich(judgment, enrichmentTags); } }
JudgmentEnrichmentService { public <T extends Judgment> void enrich(T judgment) { Preconditions.checkNotNull(judgment); List<EnrichmentTag> enrichmentTags = enrichmentTagRepository.findAllByJudgmentId(judgment.getId()); enrich(judgment, enrichmentTags); }  }
JudgmentEnrichmentService { public <T extends Judgment> void enrich(T judgment) { Preconditions.checkNotNull(judgment); List<EnrichmentTag> enrichmentTags = enrichmentTagRepository.findAllByJudgmentId(judgment.getId()); enrich(judgment, enrichmentTags); }  T findOneAndEnrich(long judgmentId); void unenrichAndSave(Judgment judgment); void enrich(T judgment); void enrich(T judgment, List<EnrichmentTag> enrichmentTags); void enrich(T judgment, EnrichmentTag enrichmentTag); @Autowired void setJudgmentRepository(JudgmentRepository judgmentRepository); @Autowired void setEnrichmentTagRepository(EnrichmentTagRepository enrichmentTagRepository); @Autowired void setEnrichmentTagApplierManager(EnrichmentTagApplierManager enrichmentTagApplierManager); @Autowired void setEntityManager(EntityManager entityManager); }
JudgmentEnrichmentService { public <T extends Judgment> void enrich(T judgment) { Preconditions.checkNotNull(judgment); List<EnrichmentTag> enrichmentTags = enrichmentTagRepository.findAllByJudgmentId(judgment.getId()); enrich(judgment, enrichmentTags); }  T findOneAndEnrich(long judgmentId); void unenrichAndSave(Judgment judgment); void enrich(T judgment); void enrich(T judgment, List<EnrichmentTag> enrichmentTags); void enrich(T judgment, EnrichmentTag enrichmentTag); @Autowired void setJudgmentRepository(JudgmentRepository judgmentRepository); @Autowired void setEnrichmentTagRepository(EnrichmentTagRepository enrichmentTagRepository); @Autowired void setEnrichmentTagApplierManager(EnrichmentTagApplierManager enrichmentTagApplierManager); @Autowired void setEntityManager(EntityManager entityManager);  }