package Tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.junit.*;
import project.*;

public class TestUserInterface extends TestBasis {
	
	@Test
	public void TestUserInterface() throws IllegalOperationException {
		setup();
		UserInterface ui = sysApp.ui;
		int size = ui.console.size();
		
		// Tests if console initialized successfully
		assertTrue(size != 0);
		
		// Tests if top-most message is cleared
		ui.shiftUp();
		assertTrue(ui.console.size() == size - 1);
		
		// Tests if a message is printed to the console
		sysApp.ui.print("test message");
		assertTrue(ui.console.size() == size);
		
		// Tests if console is properly cleared
		sysApp.ui.clear();
		assertTrue(ui.console.size() == 0);
		
		//Tests if user inputs are properly passed along
		String txt = "user input";
		ui.input.obj.setText(txt);
		ui.input.constructListener(new InputListener() {
			@Override
			public void inputSent(InputEvent e) {
				ui.input.obj.setText("");
			}
		});
		//assertTrue(ui.input.redirectInput());
		//assertTrue(ui.input.obj.getText() == "");
		//assertTrue(ui.console.size() == 1);
		//assertFalse(ui.wakeUpThread());
	}
	
}

@@ -283,16 +283,151 @@
 s %7B%0D%0A%09%0D%0A
+%09@Override%0D%0A%09public void setup() throws IllegalOperationException%7B%0D%0A%09%09super.setup();%0D%0A%09%09sysApp.ui = new UserInterface(sysApp);%0D%0A%09%7D%0D%0A%09%0D%0A
 %09@Test%0D%0A

fix af userInterfaceTest, override på setup metoden.