Exemplo n.º 1
1
 /** Test method for {@link icd3.Tank#Tank()}. */
 @Test
 public void testTank() {
   Tank defaultTank = new Tank();
   assertTrue(defaultTank.getBottom() == 0.0);
   assertTrue(defaultTank.getTop() == 0.0);
   assertTrue(defaultTank.baseArea() == 0.0);
 }
Exemplo n.º 2
1
 /** Test method for {@link icd3.Tank}. */
 @Test
 public void testTankBehavior() {
   Tank tank = new Tank();
   tank.setCoordinates(m_bottomLeft, m_topRight);
   assertTrue(tank.getBottom() == -4.5);
   assertTrue(tank.getTop() == 3.5);
   assertTrue(tank.baseArea() == 1.0);
 }
Exemplo n.º 3
0
  /** Test method for {@link icd3.Tank#equals(Object)}. */
  @Test
  public void testTankEquality() {
    Tank defaultTank = new Tank();
    double[] unitBottom = {0, 0, 0};
    double[] unitTop = {1, 1, 1};
    Tank unitTank = new Tank(unitBottom, unitTop);
    double[] otherUnitBottom = new double[3];
    double[] otherUnitTop = new double[3];
    for (int i = 0; i < 3; ++i) {
      otherUnitBottom[i] = 0;
      otherUnitTop[i] = 1;
    }
    Tank otherUnitTank = new Tank(otherUnitBottom, otherUnitTop);

    assertTrue(defaultTank.equals(defaultTank));
    assertTrue(unitTank.equals(unitTank));
    assertTrue(unitTank.equals(otherUnitTank));
    assertTrue(otherUnitTank.equals(unitTank));
    assertFalse(defaultTank.equals(null));
    assertFalse(unitTank.equals(null));
  }
Exemplo n.º 4
0
 /**
  * Test method for not enough max dimensions behavior of {@link icd3.Tank#setCoordinates(double[],
  * double[])}.
  */
 @Test(expected = IllegalArgumentException.class)
 public void testSetCoordinatesWrongMaxDimension() {
   Tank tank = new Tank();
   tank.setCoordinates(new double[3], new double[2]);
 }
Exemplo n.º 5
0
 /**
  * Test method for negative coordinate behavior of {@link icd3.Tank#setCoordinates(double[],
  * double[])}.
  */
 @Test(expected = IllegalArgumentException.class)
 public void testSetCoordinatesNegative() {
   Tank tank = new Tank();
   tank.setCoordinates(m_topRight, m_bottomLeft);
 }
Exemplo n.º 6
0
 /**
  * Test method for Illegal State behavior of {@link icd3.Tank#setCoordinates(double[], double[])}.
  */
 @Test(expected = IllegalStateException.class)
 public void testSetCoordinatesIllegalState() {
   Tank tank = new Tank();
   tank.setCoordinates(new double[3], new double[] {1, 1, 1});
   tank.setCoordinates(new double[3], new double[] {2, 2, 2});
 }