### Question:
OperationService extends PersistenceService<Operation, OperationDto, String> { public OperationQuery createQuery() { return new OperationQueryImpl(createEntityManager(), operationMapper); } @Inject  OperationService(EntityManagerFactory entityManagerFactory); OperationQuery createQuery();  }### Answer:
@Test void testAdd() { operationService.add(OPERATION_1); assertEquals(Collections.singletonList(OPERATION_1), operationService.createQuery() .list()); assertEquals(OPERATION_1, operationService.createQuery() .processId(OPERATION_1.getProcessId()) .singleResult()); }
@Test void testAddWithNonEmptyDatabase() { addOperations(List.of(OPERATION_1, OPERATION_2)); assertOperationExists(OPERATION_1.getProcessId()); assertOperationExists(OPERATION_2.getProcessId()); assertEquals(List.of(OPERATION_1, OPERATION_2), operationService.createQuery() .list()); }