### Question:
JooqBuildingDAO extends AbstractJooqDAO implements BuildingDAO { @Override public Optional<Building> findWithPlanetIdAndType(UUID planetId, BuildingType type) { Preconditions.checkNotNull(planetId, "planetId"); Preconditions.checkNotNull(type, "type"); LOGGER.debug("Finding building with planet id {} and type {}", planetId, type); Record record = context().select().from(BUILDING).where(BUILDING.PLANET_ID.eq(planetId).and(BUILDING.TYPE.eq(type.getId()))).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 testFindWithPlanetIdAndType() throws Exception { Optional<Building> building = sut.findWithPlanetIdAndType(BasicScenario.Player1.Planet1.PLANET.getId(), BuildingType.COMMAND_CENTER); assertThat(building.isPresent(), is(true)); assertThat(building.get(), is(BasicScenario.Player1.Planet1.COMMAND_CENTER)); }
@Test public void testFindWithPlanetIdAndType2() throws Exception { Optional<Building> building = sut.findWithPlanetIdAndType(BasicScenario.Player1.Planet1.PLANET.getId(), BuildingType.CRYSTAL_MINE); assertThat(building.isPresent(), is(false)); }
@Test public void testFindWithPlanetIdAndType3() throws Exception { Optional<Building> building = sut.findWithPlanetIdAndType(UUID.fromString("a1a7c2d7-0fea-41a0-b521-6c1c42b7189e"), BuildingType.COMMAND_CENTER); assertThat(building.isPresent(), is(false)); }