TollBoothHiveDestinationAdminClient implements HiveDestinationAdminClient { @Override public void deleteHiveDestination(String name) throws UnknownRoadException, UnknownDestinationException { getHiveDestination(name).orElseThrow(() -> new UnknownDestinationException("Hive", name)); List<PatchOperation> operations = new ArrayList<>(); operations.add(PatchOperation.remove(DESTINATIONS_HIVE)); PatchSet patchSet = new PatchSet(name, operations); modificationEmitter.emit(patchSet); } @Autowired  TollBoothHiveDestinationAdminClient(
      @Value("#{store}") Map<String, Road> roads,
      PatchSetEmitter modificationEmitter); @Override Optional<HiveDestination> getHiveDestination(String name); @Override void createHiveDestination(String name, HiveDestination hiveDestination); @Override void deleteHiveDestination(String name); @Override void updateHiveDestination(String name, HiveDestination hiveDestination);  }
@Test public void deleteHiveDestination() throws Exception { destinations.put("hive", hiveDestination); road.setDestinations(destinations); store.put(NAME, road); underTest.deleteHiveDestination(NAME); assertNull(store.get(NAME).getDestinations().get("hive")); }
@Test(expected = UnknownRoadException.class) public void deleteHiveDestination_UnknownRoad() throws Exception { underTest.deleteHiveDestination(NAME); }
@Test(expected = UnknownDestinationException.class) public void deleteHiveDestination_UnknownDestination() throws Exception { store.put(NAME, road); underTest.deleteHiveDestination(NAME); }
@Test(expected = UnknownRoadException.class) public void deleteHiveDestination_deletedRoad() throws Exception { road.setDeleted(true); store.put(NAME, road); underTest.deleteHiveDestination(NAME); }