package tests;

import static org.junit.Assert.*;

import java.awt.Color;

import modele.Obstacle;

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

public class ObstacleTest {
	Obstacle O;

	@Before
	public void setUp() {
		O = new Obstacle(50, 55, 10);
	}

	@Test
	public void testGetSize() {
		assertEquals(10, O.getSize());
	}
	
	@Test
	public void testGetY() {
		assertEquals(55, O.getY(),0);
	}
	
	@Test
	public void testGetC() {
		if(!O.getC().equals(Color.RED)){
			fail("Wrong color");
		}
	}

	@Test
	public void testGetX() {
		assertEquals(50, O.getX(),0);
	}
	
	@Test
	public void testTouched() {
		O.setTouched(false);
		assertFalse(O.isTouched());
	}
	
	
	@Test
	public void testMove() {
		O.move(20, 20);
		if(O.getX() != 20 || O.getY() != 20){
			fail("Move don't work");
		}
	}
}

@@ -184,16 +184,75 @@
 cle O;%0A%0A
+%09/*%0A%09 * Setting up tests before testing all other one%0A%09 */%0A
 %09@Before
@@ -252,16 +252,16 @@
 @Before%0A
-
 %09public 
@@ -307,24 +307,63 @@
 5, 10);%0A%09%7D%0A%0A
+%09/*%0A%09 * Test size of the Obstacle%0A%09 */%0A
 %09@Test%0A%09publ
@@ -416,32 +416,67 @@
 etSize());%0A%09%7D%0A%09%0A
+%09/*%0A%09 * Test if GetY is right%0A%09 */%0A
 %09@Test%0A%09public v
@@ -521,32 +521,69 @@
 getY(),0);%0A%09%7D%0A%09%0A
+%09%0A%09/*%0A%09 * Test if GetC is right%0A%09 */%0A
 %09@Test%0A%09public v
@@ -666,16 +666,51 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09/*%0A%09 * Test if GetX is right%0A%09 */%0A
 %09@Test%0A%09
@@ -803,24 +803,55 @@
 Touched() %7B%0A
+%09%09boolean tmp = O.isTouched();%0A
 %09%09O.setTouch
@@ -887,24 +887,45 @@
 Touched());%0A
+%09%09O.setTouched(tmp);%0A
 %09%7D%0A%09%0A%09%0A%09@Tes
@@ -1038,17 +1038,34 @@
 work%22);%0A
-
 %09%09%7D%0A
+%09%09O.move(50,55);%0A
 %09%7D%0A%7D%0A

test obstacles