/* * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org * * 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 org.wso2.wsas.example; import junit.framework.TestCase; public class WSO2GameServiceTestCase extends TestCase { WSO2GameService gameService; protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); gameService.endGame(); } public void testWSO2GameService() { gameService = new WSO2GameService(); gameService.startGame(); int[] guessArray = {1,2,3,4,5,6,7,8,9,10,11,12}; String result; for (int i = 0; i < guessArray.length ; i++) { result = gameService.guess(guessArray[i]); if (result != null && result.contains("You")) { break; } } } public void testWSO2GameServiceWithRange() { gameService = new WSO2GameService(); gameService.startGameWithCustomRange(1,3); int[] guessArray = {1,2,3,4,5,6,7,8,9,10,11}; String result; for (int i = 0; i < guessArray.length ; i++) { result = gameService.guess(guessArray[i]); if (result != null && result.contains("You")) { break; } } } }