@Test public void createHiveDestination() throws Exception { when(hiveDestinationAdminClient.getHiveDestination(NAME)).thenReturn(Optional.empty()); underTest.createHiveDestination(NAME, hiveDestinationModel); verify(hiveDestinationAdminClient).createHiveDestination(NAME, hiveDestination); }
@Override public void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel) throws UnknownRoadException, AlreadyExistsException { if (hiveDestinationAdminClient.getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } HiveDestination hiveDestination = new HiveDestination(); hiveDestination.setLandingInterval(validateAndNormaliseLandingInterval(hiveDestinationModel.getLandingInterval())); hiveDestination.setEnabled(hiveDestinationModel.isEnabled()); hiveDestinationAdminClient.createHiveDestination(name, hiveDestination); }
HiveDestinationServiceImpl implements HiveDestinationService { @Override public void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel) throws UnknownRoadException, AlreadyExistsException { if (hiveDestinationAdminClient.getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } HiveDestination hiveDestination = new HiveDestination(); hiveDestination.setLandingInterval(validateAndNormaliseLandingInterval(hiveDestinationModel.getLandingInterval())); hiveDestination.setEnabled(hiveDestinationModel.isEnabled()); hiveDestinationAdminClient.createHiveDestination(name, hiveDestination); } }
HiveDestinationServiceImpl implements HiveDestinationService { @Override public void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel) throws UnknownRoadException, AlreadyExistsException { if (hiveDestinationAdminClient.getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } HiveDestination hiveDestination = new HiveDestination(); hiveDestination.setLandingInterval(validateAndNormaliseLandingInterval(hiveDestinationModel.getLandingInterval())); hiveDestination.setEnabled(hiveDestinationModel.isEnabled()); hiveDestinationAdminClient.createHiveDestination(name, hiveDestination); } @Autowired  HiveDestinationServiceImpl(HiveDestinationAdminClient hiveDestinationAdminClient); }
HiveDestinationServiceImpl implements HiveDestinationService { @Override public void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel) throws UnknownRoadException, AlreadyExistsException { if (hiveDestinationAdminClient.getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } HiveDestination hiveDestination = new HiveDestination(); hiveDestination.setLandingInterval(validateAndNormaliseLandingInterval(hiveDestinationModel.getLandingInterval())); hiveDestination.setEnabled(hiveDestinationModel.isEnabled()); hiveDestinationAdminClient.createHiveDestination(name, hiveDestination); } @Autowired  HiveDestinationServiceImpl(HiveDestinationAdminClient hiveDestinationAdminClient); @Override HiveDestinationModel getHiveDestination(String name); @Override void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel); @Override void updateHiveDestination(String name, HiveDestinationModel hiveDestinationModel); @Override void deleteHiveDestination(String name); }
HiveDestinationServiceImpl implements HiveDestinationService { @Override public void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel) throws UnknownRoadException, AlreadyExistsException { if (hiveDestinationAdminClient.getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } HiveDestination hiveDestination = new HiveDestination(); hiveDestination.setLandingInterval(validateAndNormaliseLandingInterval(hiveDestinationModel.getLandingInterval())); hiveDestination.setEnabled(hiveDestinationModel.isEnabled()); hiveDestinationAdminClient.createHiveDestination(name, hiveDestination); } @Autowired  HiveDestinationServiceImpl(HiveDestinationAdminClient hiveDestinationAdminClient); @Override HiveDestinationModel getHiveDestination(String name); @Override void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel); @Override void updateHiveDestination(String name, HiveDestinationModel hiveDestinationModel); @Override void deleteHiveDestination(String name);  }