### Question:
DomainService { public Connector createConnector(Long chargingStationTypeId, Long evseId, Connector connector) { ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); Evse evse = getEvseById(chargingStationType, evseId); Set<Connector> originalConnectors = ImmutableSet.copyOf(evse.getConnectors()); evse.getConnectors().add(connector); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); Set<Connector> newConnectors = getEvseById(chargingStationType, evseId).getConnectors(); Set<Connector> diffConnectors = Sets.difference(newConnectors, originalConnectors); if (diffConnectors.size() == 1) { return Iterables.get(diffConnectors, 0); } else { return null; } }  Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model); Evse createEvse(Long chargingStationTypeId, Evse evse); Set<Evse> getEvses(Long chargingStationTypeId); ChargingStationType createChargingStationType(ChargingStationType chargingStationType); ChargingStationType updateChargingStationType(Long id, ChargingStationType chargingStationType); List<ChargingStationType> getChargingStationTypes(int offset, int limit); Long getTotalNumberOfChargingStationTypes(); ChargingStationType getChargingStationType(Long id); void deleteChargingStationType(Long id); Set<Connector> getConnectors(Long chargingStationTypeId, Long evseId); Connector createConnector(Long chargingStationTypeId, Long evseId, Connector connector); Connector updateConnector(Long chargingStationTypeId, Long evseId, Connector connector); Connector getConnector(Long chargingStationTypeId, Long evseId, Long id); void deleteConnector(Long chargingStationTypeId, Long evseId, Long id); Evse updateEvse(Long chargingStationTypeId, Evse evse); Evse getEvse(Long chargingStationTypeId, Long id); void deleteEvse(Long chargingStationTypeId, Long id); Manufacturer createManufacturer(Manufacturer manufacturer); Manufacturer updateManufacturer(Long id, Manufacturer manufacturer); List<Manufacturer> getManufacturers(int offset, int limit); Long getTotalNumberOfManufacturers(); Manufacturer getManufacturer(Long id); void deleteManufacturer(Long id); void setChargingStationTypeRepository(ChargingStationTypeRepository chargingStationTypeRepository); void setManufacturerRepository(ManufacturerRepository manufacturerRepository);  }### Answer:
@Test public void createConnector() { ChargingStationType chargingStationType = getChargingStationTypeNonTransient(entityManagerFactory); Long evseId = Iterables.get(chargingStationType.getEvses(), 0).getId(); Connector connector = TestUtils.getConnector(); Connector createdConnector = domainService.createConnector(chargingStationType.getId(), evseId, connector); connector.setId(createdConnector.getId()); assertEquals(connector, createdConnector); assertNotNull(domainService.getConnector(chargingStationType.getId(), evseId, connector.getId())); }