### Question:
ScObjectDeleter { @Transactional void deleteScjFormsWithoutJudgments() { log.debug("Deleting scjForms without referring judgments "); String q = "select scjForm.id from " + SupremeCourtJudgmentForm.class.getName() + " scjForm " + " where not exists (select judgment from "+ SupremeCourtJudgment.class.getName() + " judgment " + " join judgment.scJudgmentForm scjForm2 " + " where scjForm.id = scjForm2.id)"; @SuppressWarnings("unchecked") List<Long> scjFormIds = entityManager.createQuery(q).getResultList(); scjFormIds.stream().forEach(scJudgmentFormRepository::delete); }  @Autowired void setEntityManager(EntityManager entityManager); @Autowired void setScChamberRepository(ScChamberRepository scChamberRepository); @Autowired void setScJudgmentFormRepository(ScJudgmentFormRepository scJudgmentFormRepository); @Autowired void setScChamberDivisionRepository(ScChamberDivisionRepository scChamberDivisionRepository);  }### Answer:
@Test public void deleteScjFormsWithoutJudgments() { SupremeCourtJudgmentForm scjForm = createScjForm(true); createScjForm(false); createScjForm(false); createScjForm(false); scObjectDeleter.deleteScjFormsWithoutJudgments(); List<SupremeCourtJudgmentForm> dbScjForms = scJudgmentFormRepository.findAll(); assertEquals(1, dbScjForms.size()); assertEquals(scjForm.getId(), dbScjForms.get(0).getId()); }