mercredi 16 septembre 2020

How tests for Jpa criteria api should looks like?

I'm learning tests and I consider situation when i have class like that:

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class SearchCustomerService {
    private final CustomerRepository CustomerRepository;

    public Page<CustomerDTO> search(CustomerCriteria criteria, Pageable pageable) {
        CustomerSpecification specification = new CustomerSpecification(criteria);
        return customerRepository.findCustomers(specification, pageable);
    }
}

How tests should looks like? I think unit tests are not that really good because what am I actually testing? I'm just getting some data from database and if I mock repository.. then I test Mockito, right?

Aucun commentaire:

Enregistrer un commentaire