package nl.github.martijn9612.fishy;

import static org.junit.Assert.*;

import org.junit.Test;
import org.newdawn.slick.GameContainer;

import static org.mockito.Mockito.mock;

public class OpponentTest {
    private final GameContainer gc = mock(GameContainer.class);

    /**
     * Test case for getSize method
     */
    @Test
    public void testGetSize() {
        Opponent testopp = new Opponent(true, 0, 0, 1.0, 0);
        assertEquals(testopp.getSize(), 1.0, 0.1);
    }

    /**
     * Test case for isOffScreen method.
     * spawnsleft = true. 
     * Return condition = true.
     */
    @Test
    public void testIsOffScreen1() {
        Opponent testtruetrue = new Opponent(true, 10, 0, 1, 0);
        assertTrue(testtruetrue.isOffScreen());
    }

    /**
     * Test case for isOffScreen method.
     * spawnsleft = true. 
     * Return condition = false.
     */
    @Test
    public void testIsOffScreen2() {
        Opponent testtruefalse = new Opponent(true, 0, 0, 1, 0);
        assertFalse(testtruefalse.isOffScreen());
    }

    /**
     * Test case for isOffScreen method.
     * spawnsleft = false.
     * Return condition = true.
     */
    @Test
    public void testIsOffScreen3() {
        Opponent testfalsetrue = new Opponent(false, -2, 0, 1, 0);
        assertTrue(testfalsetrue.isOffScreen());
    }

    /**
     * Test case for isOffScreen method.
     * spawnsleft = false.
     * Return condition = false.
     */
    @Test
    public void testIsOffScreen4() {
        Opponent testfalsefalse = new Opponent(false, 10, 0, 1, 0);
        assertFalse(testfalsefalse.isOffScreen());
    }

    /**
     * Test case for objectLogic method.
     * spawnsleft = true.
     */
    @Test
    public void testObjectLogic() {
        Opponent opp = new Opponent(true, 0, 0, 1, 1);
        float centerbefore = opp.ellipse.getCenterX();
        opp.objectLogic(gc, 0);
        assertEquals(opp.ellipse.getCenterX(), centerbefore + 1, 0.1);
        assertEquals(opp.getX(), 1, 0.1);
    }

    /**
     * Test case for objectLogic method.
     * spawnsleft = false;
     */
    @Test
    public void testObjectLogic2() {
        Opponent opp = new Opponent(false, 10, 10, 1, 1);
        float centerbefore = opp.ellipse.getCenterX();
        opp.objectLogic(gc, 0);
        assertEquals(opp.ellipse.getCenterX(), centerbefore - 1, 0.1);
        assertEquals(opp.getX(), 9.0, 0.1);
    }

}

@@ -202,72 +202,8 @@
 st %7B
-%0A    private final GameContainer gc = mock(GameContainer.class);
 %0A%0A  
@@ -317,32 +317,38 @@
 t testopp = new 
+Linear
 Opponent(true, 0
@@ -479,59 +479,34 @@
   * 
-spawnsleft = true. %0A     * Return condition =
+First if statement is
  true
-.
 %0A   
@@ -551,17 +551,16 @@
 ffScreen
-1
 () %7B%0A   
@@ -581,23 +581,24 @@
 test
-truetrue
+opp
  = new 
+Linear
 Oppo
@@ -605,30 +605,30 @@
 nent(true, 1
-0
 , 
-0
+1
 , 
+-
 1, 0);%0A     
@@ -649,16 +649,11 @@
 test
-truetrue
+opp
 .isO
@@ -663,32 +663,36 @@
 creen());%0A    %7D%0A
+    
 %0A    /**%0A     * 
@@ -736,60 +736,35 @@
   * 
-spawnsleft = true. %0A     * Return condition = false.
+Second if statement is true
 %0A   
@@ -840,24 +840,23 @@
 test
-truefalse
+opp
  = new 
+Sinus
 Oppo
@@ -864,24 +864,14 @@
 ent(
-true, 0, 0, 1, 0
+10, -1
 );%0A 
@@ -887,27 +887,20 @@
 sert
-Fals
+Tru
 e(test
-truefalse
+opp
 .isO
@@ -910,32 +910,36 @@
 creen());%0A    %7D%0A
+    
 %0A    /**%0A     * 
@@ -983,346 +983,42 @@
   * 
-spawnsleft = false.%0A     * Return condition = true.%0A     */%0A    @Test%0A    public void testIsOffScreen3() %7B%0A        Opponent testfalsetrue = new Opponent(false, -2, 0, 1, 0);%0A        assertTrue(testfalsetrue.isOffScreen());%0A    %7D%0A%0A    /**%0A     * Test case for isOffScreen method.%0A     * spawnsleft = false.%0A     * Return condition = false.
+None of the if statements are true
 %0A   
@@ -1067,9 +1067,9 @@
 reen
-4
+1
 () %7B
@@ -1094,259 +1094,8 @@
 test
-falsefalse = new Opponent(false, 10, 0, 1, 0);%0A        assertFalse(testfalsefalse.isOffScreen());%0A    %7D%0A%0A    /**%0A     * Test case for objectLogic method.%0A     * spawnsleft = true.%0A     */%0A    @Test%0A    public void testObjectLogic() %7B%0A        Opponent 
 opp 
@@ -1092,32 +1092,38 @@
 t testopp = new 
+Linear
 Opponent(true, 0
@@ -1125,616 +1125,62 @@
 ue, 
-0, 0
+1
 , 1, 1
-);%0A        float centerbefore = opp.ellipse.getCenterX();%0A        opp.objectLogic(gc, 0);%0A        assertEquals(opp.ellipse.getCenterX(), centerbefore + 1, 0.1);%0A        assertEquals(opp.getX(), 1, 0.1);%0A    %7D%0A%0A    /**%0A     * Test case for objectLogic method.%0A     * spawnsleft = false;%0A     */%0A    @Test%0A    public void testObjectLogic2() %7B%0A        Opponent opp = new Opponent(false, 10, 10, 1, 1);%0A        float centerbefore = opp.ellipse.getCenterX();%0A        opp.objectLogic(gc, 0);%0A        assertEquals(opp.ellipse.getCenterX(), centerbefore - 1, 0.1);%0A        assertEquals(opp.getX(), 9.0, 0.1
+, 0);%0A        assertFalse(testopp.isOffScreen()
 );%0A 
@@ -1184,11 +1184,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Change opponenttest to fit the changed file <testing