@Test public void testGetMap() { final int mapId = 1; final WorldMap map = new WorldMap(null, mapId, (short) 1, new Tile[] {}); final WorldMapDAO dao = mock(WorldMapDAO.class); final CityDAO cityDao = mock(CityDAO.class); final AreaService areaService = mock(AreaService.class); when(dao.retrieveAll()).thenReturn(new WorldMap[] {map}); final MapService service = new MapServiceImpl(dao, cityDao, areaService); service.loadMaps(); assertSame(map, service.getMap(mapId)); }
@Override public WorldMap getMap(final int id) { if (id < 1 || id > maps.length) { return null; } return maps[id - 1]; }
MapServiceImpl extends ActionExecutor<MapService> implements MapService { @Override public WorldMap getMap(final int id) { if (id < 1 || id > maps.length) { return null; } return maps[id - 1]; } }
MapServiceImpl extends ActionExecutor<MapService> implements MapService { @Override public WorldMap getMap(final int id) { if (id < 1 || id > maps.length) { return null; } return maps[id - 1]; } @Inject  MapServiceImpl(final WorldMapDAO mapsDAO, final CityDAO citiesDAO, final AreaService areaService); }
MapServiceImpl extends ActionExecutor<MapService> implements MapService { @Override public WorldMap getMap(final int id) { if (id < 1 || id > maps.length) { return null; } return maps[id - 1]; } @Inject  MapServiceImpl(final WorldMapDAO mapsDAO, final CityDAO citiesDAO, final AreaService areaService); @Override void loadMaps(); @Override WorldMap getMap(final int id); @Override void loadCities(); @Override City getCity(final byte id); @Override void putCharacterAtPos(final Character chara, final Position pos); @Override void moveCharacterTo(final Character character, final Heading heading); }
MapServiceImpl extends ActionExecutor<MapService> implements MapService { @Override public WorldMap getMap(final int id) { if (id < 1 || id > maps.length) { return null; } return maps[id - 1]; } @Inject  MapServiceImpl(final WorldMapDAO mapsDAO, final CityDAO citiesDAO, final AreaService areaService); @Override void loadMaps(); @Override WorldMap getMap(final int id); @Override void loadCities(); @Override City getCity(final byte id); @Override void putCharacterAtPos(final Character chara, final Position pos); @Override void moveCharacterTo(final Character character, final Heading heading);  }