Demo entry 5208919

1

   

Submitted by anonymous on Jun 09, 2016 at 11:16
Language: Java. Code size: 1.4 kB.

package Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.awt.AWTException;
import javax.swing.JButton;
import javax.swing.JTextArea;
import org.junit.Before;
import org.junit.Test;
import Controller.ControllerManager;
import Model.FrameData;

public class ComponentTest {
	//시나리오를 위한 적절한변수선언
	ControllerManager manager;
	FrameData frame;
	JTextArea inputLeft;
	JTextArea inputRight;
	JButton test;

	@Before
	public void setUp()throws AWTException{
		System.out.println("setUp");
		manager = new ControllerManager();
		manager.setFrameVisible(true);
		frame = manager.getFrameData();
	}
	@Test
	public void componentTest(){//component들이 잘 set되어있는지
		String expResult1 ="right";
		String expResult2 ="left";		
		//rightTextArea가 잘 set되어있는지
		inputRight = frame.getJTextAreaLeft();
		assertNotNull("cannot access the rightField component",inputRight);
		
		//leftTextArea가 잘 set되어있는지
		inputLeft = frame.getJTextAreaRight();
		assertNotNull("cannot access the leftField component",inputLeft);
		
		//add some test to the JTextArea
		inputRight.setEditable(true);
		inputRight.setText("right");
		assertEquals(expResult1,inputRight.getText());
		
		inputLeft.setEditable(true);
		inputLeft.setText("left");
		assertEquals(expResult2,inputLeft.getText());
	}
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).