TollBoothHiveDestinationAdminClient implements HiveDestinationAdminClient { @Override public Optional<HiveDestination> getHiveDestination(String name) throws UnknownRoadException { return destinations(name).map(e -> (HiveDestination) e.get("hive")); } @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 getHiveDestination() throws Exception { destinations.put("hive", hiveDestination); road.setDestinations(destinations); store.put(NAME, road); Optional<HiveDestination> result = underTest.getHiveDestination(NAME); assertThat(result.isPresent(), is(true)); assertThat(result.get(), is(hiveDestination)); }
@Test(expected = UnknownRoadException.class) public void getHiveDestination_UnknownRoad() throws Exception { underTest.getHiveDestination(NAME); }
@Test public void getHiveDestination_NoDestination() throws Exception { store.put(NAME, road); Optional<HiveDestination> result = underTest.getHiveDestination(NAME); assertThat(result.isPresent(), is(false)); }
@Test(expected = UnknownRoadException.class) public void getHiveDestination_deletedRoad() throws Exception { road.setDeleted(true); store.put(NAME, road); underTest.getHiveDestination(NAME); }