EnforcementService implements IEnforcementService { @Override public List<IEnforcementJob> getEnforcementJobs() { return enforcementJobDAO.getAll(); }  @Override IEnforcementJob getEnforcementJob(Long id); @Override IEnforcementJob getEnforcementJobByAgreementId(String agreementId); @Override List<IEnforcementJob> getEnforcementJobs(); @Override IEnforcementJob createEnforcementJob(IEnforcementJob job); @Override IEnforcementJob createEnforcementJob(String agreementId); @Override boolean deleteEnforcementJobByAgreementId(String agreementId); @Override boolean startEnforcement(String agreementId); @Override boolean stopEnforcement(String agreementId); @Override void saveEnforcementResult(IAgreement agreement,
            Map<IGuaranteeTerm, GuaranteeTermEvaluationResult> enforcementResult); void enforceReceivedMetrics(
            IAgreement agreement, String guaranteeTermName, List<IMonitoringMetric> metrics); @Override void doEnforcement(IAgreement agreement,
            Map<IGuaranteeTerm, List<IMonitoringMetric>> metrics); @Override void saveCheckedGuaranteeTerm(IGuaranteeTerm term);  }
@Test @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void testGetEnforcementJobs() { List<IEnforcementJob> jobs = service.getEnforcementJobs(); int oldSize = jobs.size(); IAgreement agreementStored = saveAgreement(); IEnforcementJob expected = newEnforcementJob(agreementStored); try { enforcementJobDao.save(expected); } catch (Exception e) { e.printStackTrace(); } jobs = service.getEnforcementJobs(); assertEquals(oldSize + 1, jobs.size()); for (IEnforcementJob actual : jobs) { if (expected.getId().equals(actual.getId())) { assertTrue(equalJobs(expected, actual)); return; } } fail("new job not found in jobs"); }