@Test
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void testGetEnforcementJobByAgreementId() throws Exception {

    Provider provider = new Provider(null, UUID.randomUUID().toString(),
            "Provider 2");
    
    Template template = new Template();
    template.setServiceId("service");
    template.setText("asadsad");
    template.setUuid(UUID.randomUUID().toString());
    template.setProvider(provider);
    providerDao.save(provider);
    templateDao.save(template);
    
    
    IAgreement agreement = newAgreement(provider, template);
    agreementDao.save(agreement);
    
    IEnforcementJob expected = newEnforcementJob(agreement);
    enforcementJobDao.save(expected);
    
    IEnforcementJob actual;
    
    actual = service.getEnforcementJobByAgreementId(agreement.getAgreementId());
    assertTrue(equalJobs(expected, actual));
    
    actual = service.getEnforcementJobByAgreementId("noexiste");
    assertNull(actual);
}