maplisttest.java

来自「一个贪吃蛇游戏」· Java 代码 · 共 57 行

JAVA
57
字号
/**
 * @(#)MapListTest.java
 * @Unit tests for MapList class.
 *
 * @Link Scholes
 * @version 1.00 2008/7/24
 */

package Test;

import junit.framework.*;
import Data.*;

public class MapListTest extends TestCase
{
	//The MapList instance for test.
	private MapList mapList = null;
	
	//Set up the testing environment.
	protected void setUp()
	{
		mapList = new MapList();
	}
	
	//Returns the test suite of this class.
	public static Test suite()
	{
		return new TestSuite(MapList.class);
	}
	
	//Accuracy test for contructor MapList().
	public void testMapList()
	{
		assertNotNull("The instance should not be null.",mapList);
	}
	
	//Accuracy test for getList().
	public void testGetList()
	{
		String list[] = {"DEFAULT","Fatally","GAY","rush"};
		assertEquals("The list should be correct",list,mapList.getList());
	}
	
	//Accuracy test for addMap().
	public void testAddMap()
	{
		mapList.addMap("test");
		assertEquals("The result should be correct",true,mapList.hasMap("test"));
	}
	
	//Accuracy test for hasMap().
	public void testHasMap()
	{
		assertEquals("The result should be correct",true,mapList.hasMap("absurd"));
		assertEquals("The result should be correct",false,mapList.hasMap("test"));
	}
}	//end class MapListTest

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?