### Question:
JooqBuildingDAO extends AbstractJooqDAO implements BuildingDAO { @Override public Optional<Building> findWithPlanetLocationAndType(Location location, BuildingType type) { Preconditions.checkNotNull(location, "location"); Preconditions.checkNotNull(type, "type"); LOGGER.debug("Finding building with planet location {} and type {}", location, type); Record record = context().select().from(BUILDING) .join(PLANET).on(PLANET.ID.eq(BUILDING.PLANET_ID)) .where(BUILDING.TYPE.eq(type.getId())) .and(PLANET.LOCATION_GALAXY.eq(location.getGalaxy())) .and(PLANET.LOCATION_PLANET.eq(location.getPlanet())) .and(PLANET.LOCATION_SOLAR_SYSTEM.eq(location.getSolarSystem())) .fetchOne(); if (record == null) { return Optional.empty(); } return Optional.of(BuildingMapper.fromRecord(record)); } @Inject  JooqBuildingDAO(UnitOfWorkService unitOfWorkService); @Override Buildings findWithPlanetId(UUID planetId); @Override void insert(Building building); @Override void update(Building building); @Override Optional<Building> findWithPlanetLocationAndType(Location location, BuildingType type); @Override Optional<Building> findWithPlanetIdAndType(UUID planetId, BuildingType type);  }### Answer:
@Test public void testFindWithPlanetLocationAndType() throws Exception { Optional<Building> building = sut.findWithPlanetLocationAndType(BasicScenario.Player1.Planet1.PLANET.getLocation(), BuildingType.COMMAND_CENTER); assertThat(building.isPresent(), is(true)); assertThat(building.get(), is(BasicScenario.Player1.Planet1.COMMAND_CENTER)); }
@Test public void testFindWithPlanetLocationAndType2() throws Exception { Optional<Building> building = sut.findWithPlanetLocationAndType(BasicScenario.Player1.Planet1.PLANET.getLocation(), BuildingType.CRYSTAL_MINE); assertThat(building.isPresent(), is(false)); }
@Test public void testFindWithPlanetLocationAndType3() throws Exception { Optional<Building> building = sut.findWithPlanetLocationAndType(new Location(2, 3, 4), BuildingType.COMMAND_CENTER); assertThat(building.isPresent(), is(false)); }