package test;

import static org.junit.Assert.*;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;

import model.PlayerModel;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import controller.PlayerInstructionsCtrl;
import controller.PlayerLoadLevelSelectCtrl;
import boundary.PlayerApplication;
import boundary.PlayerInstructionsView;
import boundary.PlayerLevelSelectView;
import boundary.PlayerMainMenuView;
import boundary.ResourceLoader;

public class TestPlayerMainMenuView {

	PlayerApplication app;
	PlayerModel model;
	ResourceLoader loader;
	
	@Before
	public void setUp() {
	    loader = new ResourceLoader();
	    model = new PlayerModel();
	    app = new PlayerApplication(model, loader);
	}
	
	@After
	public void tearDown() {
		app.dispose();
		app = null;
	}
	
	@Test
	public void test() {
		app.setView(new PlayerMainMenuView(app, model));
		assertTrue(app.getView() instanceof PlayerMainMenuView);
		
		ActionEvent event1 = new ActionEvent(((PlayerMainMenuView) app.getView()).btnLevelSelect, 0, "yes" );
		new PlayerLoadLevelSelectCtrl(app, model).actionPerformed(event1);
		assertTrue(app.getView() instanceof PlayerLevelSelectView);
		
		app.setView(new PlayerMainMenuView(app, model));
		assertTrue(app.getView() instanceof PlayerMainMenuView);
		
		ActionEvent event2 = new ActionEvent(((PlayerMainMenuView) app.getView()).btnInstructions, 0, "yes" );
		new PlayerInstructionsCtrl(app, model).actionPerformed(event2);
		assertTrue(app.getView() instanceof PlayerInstructionsView);
		
		app.setView(new PlayerMainMenuView(app, model));
		assertTrue(app.getView() instanceof PlayerMainMenuView);
	}

}

@@ -868,24 +868,51 @@
 id test() %7B%0A
+%09%09//Set the context window%0A
 %09%09app.setVie
@@ -942,32 +942,32 @@
 w(app, model));%0A
-
 %09%09assertTrue(app
@@ -1003,32 +1003,77 @@
 ainMenuView);%0A%09%09
+//Test the btnLevelSelect and its controllers
 %0A%09%09ActionEvent e
@@ -1286,32 +1286,56 @@
 lSelectView);%0A%09%09
+//Set the context window
 %0A%09%09app.setView(n
@@ -1431,16 +1431,62 @@
 iew);%0A%09%09
+//Test the btnInstructions and its controllers
 %0A%09%09Actio
@@ -1716,123 +1716,9 @@
 w);%0A
-%09%09%0A%09%09app.setView(new PlayerMainMenuView(app, model));%0A%09%09assertTrue(app.getView() instanceof PlayerMainMenuView);%0A
 %09%7D%0A
-%0A
 %7D%0A

Comment TestPlayerMainMenuView