public void testLibertyAndImmigration() { Game game = ServerTestHelper.startServerGame(getTestMap(true)); final int population = 3; Colony colony = getStandardColony(population); ServerBuilding townHall = (ServerBuilding) colony.getBuilding(townHallType); Unit statesman = colony.getUnitList().get(0); townHall.setWorkFor(statesman); assertEquals(bellsType, statesman.getWorkType()); ServerBuilding church = (ServerBuilding) colony.getBuilding(chapelType); church.upgrade(); Unit preacher = colony.getUnitList().get(1); church.setWorkFor(preacher); assertEquals(crossesType, preacher.getWorkType()); assertEquals(0, colony.getGoodsCount(bellsType)); ServerTestHelper.newTurn(); int bells = 3; assertEquals(population, colony.getUnitCount()); assertEquals(bells, colony.getNetProductionOf(bellsType)); assertEquals(bells, colony.getGoodsCount(bellsType)); colony.addGoods(bellsType, 7); bells += 7; assertEquals(bells, colony.getGoodsCount(bellsType)); assertEquals(bells, colony.getLiberty()); colony.removeGoods(bellsType, 5); bells -= 5; assertEquals(bells, colony.getGoodsCount(bellsType)); assertEquals(bells, colony.getLiberty()); int crosses = colony.getTotalProductionOf(crossesType) - colony.getConsumptionOf(crossesType); assertEquals(crosses, colony.getNetProductionOf(crossesType)); assertEquals(crosses, colony.getGoodsCount(crossesType)); assertEquals(crosses, colony.getImmigration()); colony.addGoods(crossesType, 7); crosses += 7; assertEquals(crosses, colony.getGoodsCount(crossesType)); assertEquals(crosses, colony.getImmigration()); colony.removeGoods(crossesType, 5); crosses -= 5; assertEquals(crosses, colony.getGoodsCount(crossesType)); assertEquals(crosses, colony.getImmigration()); }