### Question:
BuildingServiceImpl implements BuildingService { @Override public Resources calculateBuildCost(BuildingType type, int level, Technologies technologies) { Preconditions.checkNotNull(type, "type"); Preconditions.checkArgument(level > 0, "level must be > 0"); Preconditions.checkNotNull(technologies, "technologies"); Resources cost = buildingMechanics.calculateBuildCost(type, level); int technologyLevel = technologies.getLevel(TechnologyType.BUILDING_BUILD_COST_REDUCTION); double buildCostReduction = technologyMechanics.calculateBuildCostReduction(technologyLevel); double costMultiplier = Math.max(1 - buildCostReduction, 0); return new Resources(MathExt.floorLong(cost.getCrystals() * costMultiplier), MathExt.floorLong(cost.getGas() * costMultiplier), MathExt.floorLong(cost.getEnergy() * costMultiplier)); } @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 testCalculateBuildCost() throws Exception { when(buildingMechanics.calculateBuildCost(BuildingType.RESEARCH_CENTER, 5)).thenReturn(new Resources(100, 200, 300)); when(technologyMechanics.calculateBuildCostReduction(10)).thenReturn(0.5); Technology technology = new Technology(UUID.randomUUID(), TechnologyType.BUILDING_BUILD_COST_REDUCTION, 10, Data.Player1.PLAYER.getId()); Resources buildCost = sut.calculateBuildCost(BuildingType.RESEARCH_CENTER, 5, new Technologies(technology)); assertThat(buildCost, is(new Resources(50, 100, 150))); }