PayCheckRepository extends AbstractRepository<PayCheck> { public PayCheck findByTaxCalculation(TaxCalculation taxCalculation) { TypedQuery<PayCheck> typedQuery = entityManager.createNamedQuery(PayCheck.FIND_BY_TAXCALCULATION, PayCheck.class); typedQuery.setParameter("taxCalculationId", taxCalculation.getId()); return typedQuery.getSingleResult(); }  PayCheck findByTaxCalculation(TaxCalculation taxCalculation);  }
@Test public void testFindByTaxCalculation() throws Exception { PayCheck byTaxCalculation = payCheckRepository.findByTaxCalculation(january); assertThat(byTaxCalculation).isEqualsToByComparingFields(payCheck); assertThat(payCheck.getPayCheckPdf().length).isEqualTo(SIZE_10_MB); }