Package es.mahulo.battleship.mocks

Source Code of es.mahulo.battleship.mocks.GameConfigDaoMock

package es.mahulo.battleship.mocks;

import java.util.ArrayList;
import java.util.List;

import es.mahulo.battleship.api.dao.GameConfigDao;
import es.mahulo.battleship.model.GameConfig;
import es.mahulo.battleship.model.ShipConfig;

public class GameConfigDaoMock implements GameConfigDao {
  private GameConfig gameConfig;
 
  public GameConfigDaoMock() {
    List<ShipConfig> shipConfigs = new ArrayList<ShipConfig>();

    ShipConfig shipConfig1 = new ShipConfig();
    shipConfig1.setId(1L);
    shipConfig1.setName("aircraft carrier");
    shipConfig1.setNumber(1);
    shipConfig1.setSize(5);
    shipConfigs.add(shipConfig1);
   
    ShipConfig shipConfig2 = new ShipConfig();
    shipConfig2.setId(2L);
    shipConfig2.setName("battleship");
    shipConfig2.setNumber(1);
    shipConfig2.setSize(4);
    shipConfigs.add(shipConfig2);

    ShipConfig shipConfig3 = new ShipConfig();
    shipConfig3.setId(3L);
    shipConfig3.setName("cruiser");
    shipConfig3.setNumber(1);
    shipConfig3.setSize(3);
    shipConfigs.add(shipConfig3);
   
    ShipConfig shipConfig4 = new ShipConfig();
    shipConfig4.setId(4L);
    shipConfig4.setName("destroyer");
    shipConfig4.setNumber(2);
    shipConfig4.setSize(2);
    shipConfigs.add(shipConfig4);
   
   
    ShipConfig shipConfig5 = new ShipConfig();
    shipConfig5.setId(5L);
    shipConfig5.setName("submarine");
    shipConfig5.setNumber(2);
    shipConfig5.setSize(1);
    shipConfigs.add(shipConfig5);
   
   
    gameConfig = new GameConfig();
    gameConfig.setDimensionX(10);
    gameConfig.setDimensionY(10);
    gameConfig.setShipConfigs(shipConfigs);
   
   
   
  }

  @Override
  public GameConfig find(Long id) {
    return gameConfig;
  }
 
}

TOP

Related Classes of es.mahulo.battleship.mocks.GameConfigDaoMock

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.