@Test public void fetchOrCreateMeansOfAppeal_FETCH() { MeansOfAppeal meansOfAppeal = new MeansOfAppeal(CourtType.SUPREME, "text"); when(meansOfAppealRepository.findOneByCourtTypeAndNameIgnoreCase(meansOfAppeal.getCourtType(), meansOfAppeal.getName())) .thenReturn(meansOfAppeal); MeansOfAppeal retMeansOfAppeal = meansOfAppealCreator.fetchOrCreateMeansOfAppeal(meansOfAppeal.getCourtType(), meansOfAppeal.getName()); assertTrue(meansOfAppeal == retMeansOfAppeal); verify(meansOfAppealRepository).findOneByCourtTypeAndNameIgnoreCase(meansOfAppeal.getCourtType(), meansOfAppeal.getName()); verifyNoMoreInteractions(meansOfAppealRepository); }
public MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name) { MeansOfAppeal meansOfAppeal = meansOfAppealRepository.findOneByCourtTypeAndNameIgnoreCase(courtType, name); if (meansOfAppeal == null) { meansOfAppeal = new MeansOfAppeal(courtType, name); meansOfAppealRepository.save(meansOfAppeal); meansOfAppealRepository.flush(); } return meansOfAppeal; }
JudgmentMeansOfAppealCreator { public MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name) { MeansOfAppeal meansOfAppeal = meansOfAppealRepository.findOneByCourtTypeAndNameIgnoreCase(courtType, name); if (meansOfAppeal == null) { meansOfAppeal = new MeansOfAppeal(courtType, name); meansOfAppealRepository.save(meansOfAppeal); meansOfAppealRepository.flush(); } return meansOfAppeal; } }
JudgmentMeansOfAppealCreator { public MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name) { MeansOfAppeal meansOfAppeal = meansOfAppealRepository.findOneByCourtTypeAndNameIgnoreCase(courtType, name); if (meansOfAppeal == null) { meansOfAppeal = new MeansOfAppeal(courtType, name); meansOfAppealRepository.save(meansOfAppeal); meansOfAppealRepository.flush(); } return meansOfAppeal; }  }
JudgmentMeansOfAppealCreator { public MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name) { MeansOfAppeal meansOfAppeal = meansOfAppealRepository.findOneByCourtTypeAndNameIgnoreCase(courtType, name); if (meansOfAppeal == null) { meansOfAppeal = new MeansOfAppeal(courtType, name); meansOfAppealRepository.save(meansOfAppeal); meansOfAppealRepository.flush(); } return meansOfAppeal; }  MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name); @Autowired void setMeansOfAppealRepository(MeansOfAppealRepository meansOfAppealRepository); }
JudgmentMeansOfAppealCreator { public MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name) { MeansOfAppeal meansOfAppeal = meansOfAppealRepository.findOneByCourtTypeAndNameIgnoreCase(courtType, name); if (meansOfAppeal == null) { meansOfAppeal = new MeansOfAppeal(courtType, name); meansOfAppealRepository.save(meansOfAppeal); meansOfAppealRepository.flush(); } return meansOfAppeal; }  MeansOfAppeal fetchOrCreateMeansOfAppeal(CourtType courtType, String name); @Autowired void setMeansOfAppealRepository(MeansOfAppealRepository meansOfAppealRepository);  }