### Question:
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);  }### Answer:
@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); }
@Test public void getOrCreateScJudgmentForm_CREATED() { String judgmentFormName = "wyrok"; when(scJudgmentFormRepository.findOneByName(judgmentFormName)).thenReturn(null); SupremeCourtJudgmentForm retScJudgmentForm = scJudgmentFormCreator.getOrCreateScJudgmentForm(judgmentFormName); assertNotNull(retScJudgmentForm); assertEquals(judgmentFormName, retScJudgmentForm.getName()); verify(scJudgmentFormRepository).findOneByName(judgmentFormName); verify(scJudgmentFormRepository).saveAndFlush(retScJudgmentForm); verifyNoMoreInteractions(scJudgmentFormRepository); }