@Test public void testFindSuccessfulByTaxCalculation_returnsNullWhenNoCall() { TaxCalculation march = new TaxCalculationTestBuilder() .withEmployee(employee) .withMonth(3) .withTax(10.0) .build(); ; taxCalculationRepository.save(march); TaxWebserviceCallResult successfulByTaxCalculation = taxWebserviceCallResultRepository.findSuccessfulByTaxCalculation(march); assertThat(successfulByTaxCalculation).isNull(); }
public TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation) { TypedQuery<TaxWebserviceCallResult> byTaxCalculation = entityManager.createNamedQuery(TaxWebserviceCallResult.FIND_SUCCESSFUL_BY_TAXCALCULATION, TaxWebserviceCallResult.class); byTaxCalculation.setParameter("taxCalculationId", taxCalculation.getId()); byTaxCalculation.setMaxResults(1); try { return byTaxCalculation.getSingleResult(); } catch (NoResultException e) { return null; } }
TaxWebserviceCallResultRepository extends AbstractRepository<TaxWebserviceCallResult> { public TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation) { TypedQuery<TaxWebserviceCallResult> byTaxCalculation = entityManager.createNamedQuery(TaxWebserviceCallResult.FIND_SUCCESSFUL_BY_TAXCALCULATION, TaxWebserviceCallResult.class); byTaxCalculation.setParameter("taxCalculationId", taxCalculation.getId()); byTaxCalculation.setMaxResults(1); try { return byTaxCalculation.getSingleResult(); } catch (NoResultException e) { return null; } } }
TaxWebserviceCallResultRepository extends AbstractRepository<TaxWebserviceCallResult> { public TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation) { TypedQuery<TaxWebserviceCallResult> byTaxCalculation = entityManager.createNamedQuery(TaxWebserviceCallResult.FIND_SUCCESSFUL_BY_TAXCALCULATION, TaxWebserviceCallResult.class); byTaxCalculation.setParameter("taxCalculationId", taxCalculation.getId()); byTaxCalculation.setMaxResults(1); try { return byTaxCalculation.getSingleResult(); } catch (NoResultException e) { return null; } }  }
TaxWebserviceCallResultRepository extends AbstractRepository<TaxWebserviceCallResult> { public TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation) { TypedQuery<TaxWebserviceCallResult> byTaxCalculation = entityManager.createNamedQuery(TaxWebserviceCallResult.FIND_SUCCESSFUL_BY_TAXCALCULATION, TaxWebserviceCallResult.class); byTaxCalculation.setParameter("taxCalculationId", taxCalculation.getId()); byTaxCalculation.setMaxResults(1); try { return byTaxCalculation.getSingleResult(); } catch (NoResultException e) { return null; } }  List<TaxWebserviceCallResult> findByTaxCalculation(TaxCalculation taxCalculation); TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation); }
TaxWebserviceCallResultRepository extends AbstractRepository<TaxWebserviceCallResult> { public TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation) { TypedQuery<TaxWebserviceCallResult> byTaxCalculation = entityManager.createNamedQuery(TaxWebserviceCallResult.FIND_SUCCESSFUL_BY_TAXCALCULATION, TaxWebserviceCallResult.class); byTaxCalculation.setParameter("taxCalculationId", taxCalculation.getId()); byTaxCalculation.setMaxResults(1); try { return byTaxCalculation.getSingleResult(); } catch (NoResultException e) { return null; } }  List<TaxWebserviceCallResult> findByTaxCalculation(TaxCalculation taxCalculation); TaxWebserviceCallResult findSuccessfulByTaxCalculation(TaxCalculation taxCalculation);  }