@Test public void test_should_fetch_all_service_groups() { when(serviceGroupQueryBuilder.getQuery(any(ServiceGroupGetRequest.class), anyListOf(Object.class))).thenReturn("Query"); List<ServiceGroup> serviceGroupList = getServiceGroupTypes() ; when(jdbcTemplate.query(any(String.class),anyListOf(Object.class).toArray(), any(ServiceGroupRowMapper.class))).thenReturn(serviceGroupList); assertTrue(serviceGroupList.equals(serviceGroupRepository.getAllServiceGroup(prepareServiceGroupGetReq()))); verify(jdbcTemplate, times(1)).query(any(String.class),anyListOf(Object.class).toArray(), any(ServiceGroupRowMapper.class)); }
public List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest) { LOGGER.info("Requesting the Service Group List for the tenant ID :" + serviceGroupGetRequest.getTenantId()); final List<Object> preparedStatementValues = new ArrayList<>(); String getQuery = serviceGroupQueryBuilder.getQuery(serviceGroupGetRequest, preparedStatementValues); final List<ServiceGroup> serviceGroupTypes = jdbcTemplate.query(getQuery, preparedStatementValues.toArray(), serviceGroupMapper); return serviceGroupTypes; }
ServiceGroupRepository { public List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest) { LOGGER.info("Requesting the Service Group List for the tenant ID :" + serviceGroupGetRequest.getTenantId()); final List<Object> preparedStatementValues = new ArrayList<>(); String getQuery = serviceGroupQueryBuilder.getQuery(serviceGroupGetRequest, preparedStatementValues); final List<ServiceGroup> serviceGroupTypes = jdbcTemplate.query(getQuery, preparedStatementValues.toArray(), serviceGroupMapper); return serviceGroupTypes; } }
ServiceGroupRepository { public List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest) { LOGGER.info("Requesting the Service Group List for the tenant ID :" + serviceGroupGetRequest.getTenantId()); final List<Object> preparedStatementValues = new ArrayList<>(); String getQuery = serviceGroupQueryBuilder.getQuery(serviceGroupGetRequest, preparedStatementValues); final List<ServiceGroup> serviceGroupTypes = jdbcTemplate.query(getQuery, preparedStatementValues.toArray(), serviceGroupMapper); return serviceGroupTypes; }  }
ServiceGroupRepository { public List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest) { LOGGER.info("Requesting the Service Group List for the tenant ID :" + serviceGroupGetRequest.getTenantId()); final List<Object> preparedStatementValues = new ArrayList<>(); String getQuery = serviceGroupQueryBuilder.getQuery(serviceGroupGetRequest, preparedStatementValues); final List<ServiceGroup> serviceGroupTypes = jdbcTemplate.query(getQuery, preparedStatementValues.toArray(), serviceGroupMapper); return serviceGroupTypes; }  ServiceGroupRequest persistCreateServiceGroup(final ServiceGroupRequest serviceGroupRequest); ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest); List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest); boolean verifyRequestUniqueness(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfNameAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfCodeAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); }
ServiceGroupRepository { public List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest) { LOGGER.info("Requesting the Service Group List for the tenant ID :" + serviceGroupGetRequest.getTenantId()); final List<Object> preparedStatementValues = new ArrayList<>(); String getQuery = serviceGroupQueryBuilder.getQuery(serviceGroupGetRequest, preparedStatementValues); final List<ServiceGroup> serviceGroupTypes = jdbcTemplate.query(getQuery, preparedStatementValues.toArray(), serviceGroupMapper); return serviceGroupTypes; }  ServiceGroupRequest persistCreateServiceGroup(final ServiceGroupRequest serviceGroupRequest); ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest); List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest); boolean verifyRequestUniqueness(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfNameAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfCodeAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); static final Logger LOGGER; }