Package ingsw.proj.cluedo.junittests

Source Code of ingsw.proj.cluedo.junittests.CasellaPortaTest

package ingsw.proj.cluedo.junittests;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import ingsw.proj.cluedo.componenti.Casella;
import ingsw.proj.cluedo.componenti.CasellaPorta;
import ingsw.proj.cluedo.componenti.StanzeEnum;

import java.awt.Point;

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

public class CasellaPortaTest {

  private CasellaPorta casella;
  @SuppressWarnings(value={"unused"})
  private Casella destinazione;

  @Before
  public void setUp() throws Exception {
    destinazione = new Casella(StanzeEnum.CAMERA_LETTO, new Point(3, 2));
    casella = new CasellaPorta(StanzeEnum.CORRIDOIO, new Point(3, 4), new Point(3,2));
  }

  @After
  public void tearDown() throws Exception {
    destinazione = null;
    casella = null;
    System.gc();
  }

  @Test
  public void testCasellaPorta() {
    assertNotNull(casella);
    assertTrue(casella instanceof CasellaPorta);
    assertTrue(casella instanceof Casella);
  }

  @Test(expected = NullPointerException.class)
  public void testCasellaPortaNull() {
    new CasellaPorta(null, new Point(2, 3), new Point(2,3));
    new CasellaPorta(StanzeEnum.CAMERA_LETTO, new Point(2, 3), null);
    new CasellaPorta(null, null, null);
  }

  @Test
  public void testGetDestinazione() {
    assertNotNull(casella.getDestinazione());
    assertTrue(casella.getDestinazione() instanceof Point);
  }

}
TOP

Related Classes of ingsw.proj.cluedo.junittests.CasellaPortaTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.