@Test public void getOrCreateScJudgmentForm_FOUND() { String judgmentFormName = "wyrok"; SupremeCourtJudgmentForm scJudgmentForm = new SupremeCourtJudgmentForm(); when(scJudgmentFormRepository.findOneByName(judgmentFormName)).thenReturn(scJudgmentForm); SupremeCourtJudgmentForm retScJudgmentForm = scJudgmentFormCreator.getOrCreateScJudgmentForm(judgmentFormName); assertTrue(scJudgmentForm == retScJudgmentForm); verify(scJudgmentFormRepository).findOneByName(judgmentFormName); verifyNoMoreInteractions(scJudgmentFormRepository); }
public SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName) { Preconditions.checkArgument(!StringUtils.isBlank(judgmentFormName)); SupremeCourtJudgmentForm judgmentForm = scJudgmentFormRepository.findOneByName(judgmentFormName); if (judgmentForm == null) { judgmentForm = new SupremeCourtJudgmentForm(); judgmentForm.setName(judgmentFormName); scJudgmentFormRepository.saveAndFlush(judgmentForm); } return judgmentForm; }
ScJudgmentFormCreator { public SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName) { Preconditions.checkArgument(!StringUtils.isBlank(judgmentFormName)); SupremeCourtJudgmentForm judgmentForm = scJudgmentFormRepository.findOneByName(judgmentFormName); if (judgmentForm == null) { judgmentForm = new SupremeCourtJudgmentForm(); judgmentForm.setName(judgmentFormName); scJudgmentFormRepository.saveAndFlush(judgmentForm); } return judgmentForm; } }
ScJudgmentFormCreator { public SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName) { Preconditions.checkArgument(!StringUtils.isBlank(judgmentFormName)); SupremeCourtJudgmentForm judgmentForm = scJudgmentFormRepository.findOneByName(judgmentFormName); if (judgmentForm == null) { judgmentForm = new SupremeCourtJudgmentForm(); judgmentForm.setName(judgmentFormName); scJudgmentFormRepository.saveAndFlush(judgmentForm); } return judgmentForm; }  }
ScJudgmentFormCreator { public SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName) { Preconditions.checkArgument(!StringUtils.isBlank(judgmentFormName)); SupremeCourtJudgmentForm judgmentForm = scJudgmentFormRepository.findOneByName(judgmentFormName); if (judgmentForm == null) { judgmentForm = new SupremeCourtJudgmentForm(); judgmentForm.setName(judgmentFormName); scJudgmentFormRepository.saveAndFlush(judgmentForm); } return judgmentForm; }  SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName); @Autowired void setScJudgmentFormRepository(ScJudgmentFormRepository scJudgmentFormRepository); }
ScJudgmentFormCreator { public SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName) { Preconditions.checkArgument(!StringUtils.isBlank(judgmentFormName)); SupremeCourtJudgmentForm judgmentForm = scJudgmentFormRepository.findOneByName(judgmentFormName); if (judgmentForm == null) { judgmentForm = new SupremeCourtJudgmentForm(); judgmentForm.setName(judgmentFormName); scJudgmentFormRepository.saveAndFlush(judgmentForm); } return judgmentForm; }  SupremeCourtJudgmentForm getOrCreateScJudgmentForm(String judgmentFormName); @Autowired void setScJudgmentFormRepository(ScJudgmentFormRepository scJudgmentFormRepository);  }