@Test
	public void testTrade() {
		//offer trade
		OfferTradeRequest offerRequest = new OfferTradeRequest(0, new ResourceHand(1, 1, 0, -1, -1), 1);
		ServerModel aGame = gamesList.get(1);
		
		TradeOffer trade = aGame.getTradeOffer();
		assertEquals(trade, null);
		
		try {
			aGame = moves.offerTrade(offerRequest, cookie);
		}
		catch(InvalidMovesRequest e) {
			System.out.println(e.getMessage());
		}
		
		assertEquals(aGame.getTradeOffer().getSender(), 0);
		assertEquals(aGame.getTradeOffer().getReceiver(), 1);
		
		Resources offer = aGame.getTradeOffer().getOffer();
		assertEquals(offer.brick, 1);
		assertEquals(offer.wood, 1);
		assertEquals(offer.sheep, 0);
		assertEquals(offer.wheat, -1);
		assertEquals(offer.ore, -1);
		
		//accept trade
		int p1TotalBrickBEFORE = aGame.getPlayers().get(0).getBrick();
		int p1TotalWoodBEFORE = aGame.getPlayers().get(0).getWood();
		int p1TotalSheepBEFORE = aGame.getPlayers().get(0).getSheep();
		int p1TotalWheatBEFORE = aGame.getPlayers().get(0).getWheat();
		int p1TotalOreBEFORE = aGame.getPlayers().get(0).getOre();
		
		int p2TotalBrickBEFORE = aGame.getPlayers().get(1).getBrick();
		int p2TotalWoodBEFORE = aGame.getPlayers().get(1).getWood();
		int p2TotalSheepBEFORE = aGame.getPlayers().get(1).getSheep();
		int p2TotalWheatBEFORE = aGame.getPlayers().get(1).getWheat();
		int p2TotalOreBEFORE = aGame.getPlayers().get(1).getOre();
		
		AcceptTradeRequest acceptRequest = new AcceptTradeRequest(1, false);
		
		try {
			aGame = moves.acceptTrade(acceptRequest, cookie);
			
			Player p1 = aGame.getPlayers().get(0);
			Player p2 = aGame.getPlayers().get(1);
			
			assertEquals(p1.getBrick(), p1TotalBrickBEFORE);
			assertEquals(p1.getWood(), p1TotalWoodBEFORE);
			assertEquals(p1.getSheep(), p1TotalSheepBEFORE);
			assertEquals(p1.getWheat(), p1TotalWheatBEFORE);
			assertEquals(p1.getOre(), p1TotalOreBEFORE);
			
			assertEquals(p2.getBrick(), p1TotalBrickBEFORE);
			assertEquals(p2.getWood(), p1TotalWoodBEFORE);
			assertEquals(p2.getSheep(), p1TotalSheepBEFORE);
			assertEquals(p2.getWheat(), p1TotalWheatBEFORE);
			assertEquals(p2.getOre(), p1TotalOreBEFORE);
			
		}
		catch(InvalidMovesRequest e) {
			System.out.println(e.getMessage());
		}
		
		offerRequest = new OfferTradeRequest(0, new ResourceHand(1, 1, 0, -1, -1), 1);
		acceptRequest = new AcceptTradeRequest(1, true);
		
		try {
			aGame = moves.offerTrade(offerRequest, cookie);
			aGame = moves.acceptTrade(acceptRequest, cookie);
			
			Player p1 = aGame.getPlayers().get(0);
			Player p2 = aGame.getPlayers().get(1);
			
			assertEquals(p1.getBrick(), p1TotalBrickBEFORE-1);
			assertEquals(p1.getWood(), p1TotalWoodBEFORE-1);
			assertEquals(p1.getSheep(), p1TotalSheepBEFORE);
			assertEquals(p1.getWheat(), p1TotalWheatBEFORE+1);
			assertEquals(p1.getOre(), p1TotalOreBEFORE+1);
			
			assertEquals(p2.getBrick(), p2TotalBrickBEFORE+1);
			assertEquals(p2.getWood(), p2TotalWoodBEFORE+1);
			assertEquals(p2.getSheep(), p2TotalSheepBEFORE);
			assertEquals(p2.getWheat(), p2TotalWheatBEFORE-1);
			assertEquals(p2.getOre(), p2TotalOreBEFORE-1);
			
		}
		catch(InvalidMovesRequest e) {
			System.out.println(e.getMessage());
		}
		
		//maritime trade
		aGame.getPlayers().get(0).setBrick(4);
		aGame.getPlayers().get(0).setWheat(3);
		aGame.getPlayers().get(0).setWood(2);
		aGame.getPlayers().get(0).setOre(0);
		aGame.getPlayers().get(0).setSheep(0);
		int bankTotalBrickBEFORE = aGame.getBank().brick;
		int bankTotalWoodBEFORE = aGame.getBank().wood;
		int bankTotalSheepBEFORE = aGame.getBank().sheep;
		int bankTotalWheatBEFORE = aGame.getBank().wheat;
		int bankTotalOreBEFORE = aGame.getBank().ore;
		
		MaritimeTradeRequest maritimeBrickRequest = new MaritimeTradeRequest(0, 4, "brick", "ore");
		MaritimeTradeRequest maritimeWheatRequest = new MaritimeTradeRequest(0, 3, "wheat", "ore");
		MaritimeTradeRequest maritimeWoodRequest = new MaritimeTradeRequest(0, 2, "wood", "ore");
		
		try {
			moves.maritimeTrade(maritimeBrickRequest, cookie);
			moves.maritimeTrade(maritimeWheatRequest, cookie);
			moves.maritimeTrade(maritimeWoodRequest, cookie);
			aGame = gamesList.get(1);
			
			Player p1 = aGame.getPlayers().get(0);
			
			assertEquals(p1.getBrick(), 0);
			assertEquals(p1.getWood(), 0);
			assertEquals(p1.getSheep(), 0);
			assertEquals(p1.getWheat(), 0);
			assertEquals(p1.getOre(), 3);
			
			assertEquals(aGame.getBank().brick, bankTotalBrickBEFORE + 4);
			assertEquals(aGame.getBank().wheat, bankTotalWheatBEFORE + 3);
			assertEquals(aGame.getBank().wood, bankTotalWoodBEFORE + 2);
			assertEquals(aGame.getBank().sheep, bankTotalSheepBEFORE);
			assertEquals(aGame.getBank().ore, bankTotalOreBEFORE - 3);
			
		}
		catch(InvalidMovesRequest e) {
			System.out.println(e.getMessage());
		}
	}