### Question:
BuildingServiceImpl implements BuildingService { @Override public long calculateBuildTime(BuildingType type, int level, Technologies technologies, Buildings buildings) { Preconditions.checkNotNull(type, "type"); Preconditions.checkArgument(level > 0, "level must be > 0"); Preconditions.checkNotNull(technologies, "technologies"); Preconditions.checkNotNull(buildings, "buildings"); int buildTime = buildingMechanics.calculateBuildTime(type, level); int commandCenterLevel = buildings.getLevel(BuildingType.COMMAND_CENTER); double speedUp = buildingMechanics.calculateBuildingBuildTimeSpeedup(commandCenterLevel); return Math.max(MathExt.floorLong(buildTime * (1 - speedUp)), 1); } @Inject  BuildingServiceImpl(UUIDFactory uuidFactory, BuildingDAO buildingDAO, RoundService roundService, ConstructionSiteDAO constructionSiteDAO, PlanetDAO planetDAO, EventService eventService, TechnologyDAO technologyDAO, BuildingMechanics buildingMechanics, TechnologyMechanics technologyMechanics); @Override Buildings findBuildingsOnPlanet(Planet planet); @Override List<ConstructionSite> findConstructionSitesOnPlanet(Planet planet); @Override void manifestBuilding(Planet planet, BuildingType type, int level); @Override ConstructionSite constructBuilding(Planet planet, BuildingType type); @Override ConstructionSite upgradeBuilding(Planet planet, BuildingType type); @Override ConstructionSite constructOrUpgradeBuilding(Planet planet, BuildingType type); @Override Resources calculateBuildCostWithoutBonuses(BuildingType type, int level); @Override void finishConstructionSites(); @Override long calculateBuildTime(BuildingType type, int level, Technologies technologies, Buildings buildings); @Override long calculateBuildTimeWithoutBonuses(BuildingType type, int level); @Override Resources calculateBuildCost(BuildingType type, int level, Technologies technologies);  }### Answer:
@Test public void testCalculateBuildTime() throws Exception { Building commandCenter = new Building(UUID.randomUUID(), BuildingType.COMMAND_CENTER, 10, Data.Player1.Planet1.PLANET.getId()); when(buildingMechanics.calculateBuildTime(BuildingType.RESEARCH_CENTER, 5)).thenReturn(100); when(buildingMechanics.calculateBuildingBuildTimeSpeedup(10)).thenReturn(0.5); long buildTime = sut.calculateBuildTime(BuildingType.RESEARCH_CENTER, 5, Technologies.NONE, new Buildings(commandCenter)); assertThat(buildTime, is(50L)); }