package warGame.JUnitTest;

import warGame.Model.WarGameCharacterModel;
import warGame.Model.WarGameItemModel;
import junit.framework.TestCase;

public class CharacterModelTest1 extends TestCase{

	WarGameCharacterModel characterModel = new WarGameCharacterModel();
	WarGameItemModel itemModel = new WarGameItemModel();
	
	
	public void setUp() throws Exception {
		System.out.println("Character Test1 begins");
		characterModel.createCharacter(0);
		itemModel.createItem("Ring","Strength","3");
	}
	
	public void tearDown() throws Exception {
		System.out.println("Character Test1 ends");
		System.out.println();
	}
	
	public void testSetEquipChanged(){
		System.out.println("Equip or unequip will affect ability scores");
		String score[] = new String[2];
		String changeBefore = new String();
		String changeAfter = new String();
		String scoreBefore[] = new String[18];
		String scoreAfter[] = new String[18];
		String itemType = itemModel.getItemType();
		String enchanType = itemModel.getEnchanType();		
		String enchanNum = itemModel.getEnchanNumber();
		for(int i=0;i<18;i++)
		{
			score = characterModel.getScore(i);
			scoreBefore[i] = score[1];
		}
		//equip
		scoreBefore[1] = Integer.parseInt(scoreBefore[1])+3+"";
		scoreBefore[12] = Integer.parseInt(scoreBefore[12])+3+"";
		scoreBefore[9] = Integer.parseInt(scoreBefore[9])+3+"";
		int damage = 0;
		scoreBefore[10] = damage+"";
		changeAfter = itemType+" "+enchanType+" "+enchanNum;
		characterModel.setEquipChanged(null,changeAfter);
		for(int i=0;i<18;i++)
		{
			score = characterModel.getScore(i);
			scoreAfter[i] = score[1];
			assertEquals(scoreBefore[i], scoreAfter[i]);
		}
		//unequip
		scoreBefore[1] = Integer.parseInt(scoreBefore[1])-3+"";
		scoreBefore[12] = Integer.parseInt(scoreBefore[12])-3+"";
		scoreBefore[9] = Integer.parseInt(scoreBefore[9])-3+"";
		damage = 0;
		scoreBefore[10] = damage+"";
		characterModel.setEquipChanged(changeAfter,null);
		for(int i=0;i<18;i++)
		{
			score = characterModel.getScore(i);
			scoreAfter[i] = score[1];
			assertEquals(scoreBefore[i], scoreAfter[i]);
		}
	}
}

@@ -21,16 +21,45 @@
 tTest;%0A%0A
+import java.util.ArrayList;%0A%0A
 import w
@@ -471,16 +471,90 @@
 ter(0);%0A
+%09%09ArrayList%3CString%3E str = new ArrayList%3CString%3E();%0A%09%09str.add(%22Freezing%22);%0A
 %09%09itemMo
@@ -589,16 +589,24 @@
 gth%22,%223%22
+,str,%221%22
 );%0A%09%7D%0A%09%0A

fix errors