/** * Copyright 2014 the staff of 52°North Initiative for Geospatial Open * Source Software GmbH in their free time * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package spare.n52.yadarts.layout.board; import java.util.Collections; import java.util.List; import org.junit.Test; import spare.n52.yadarts.layout.BasicX01GameView; import spare.n52.yadarts.layout.GameParameter; public class BasicX01GameViewTest { @Test(expected = IllegalArgumentException.class) public void testInitialization() { BasicX01GameView gv = new BasicX01GameView() { @Override public String getGameName() { return "testGame"; } @Override protected int getDesiredTargetScore() { return 42; } }; List<GameParameter<?>> params = gv.getInputParameters(); fillParams(params); try { gv.initialize(null, 0, params); } catch (IllegalArgumentException e) { //expected throw e; } } private void fillParams(List<GameParameter<?>> params) { for (GameParameter<?> gameParameter : params) { if (gameParameter.getType() == String.class) { GameParameter<String> sp = (GameParameter<String>) gameParameter; sp.setValue(Collections.singletonList("entry")); } else if (gameParameter.getType() == Integer.class) { GameParameter<Integer> ip = (GameParameter<Integer>) gameParameter; ip.setValue(Collections.singletonList(1)); } } } }