Esempio n. 1
0
  @Test
  public void testReveal() {
    // TODO: test for setRevealed() return value?
    assertFalse("Square should not be revealed by default", s.isRevealed());

    s.setRevealed(true);
    assertTrue("Square should be revealed after calling setRevealed", s.isRevealed());
  }
Esempio n. 2
0
  @Test
  public void testObservable() {
    TestObserver observer = new TestObserver();

    s.addObserver(observer);
    s.setRevealed(true);

    assertTrue("Square should update observers after revealing", observer.updated);
  }
 /** Test of square method, of class Square. */
 @Test
 public void testSquare_input_minus_5() {
   System.out.println("square of 5");
   int number = -5;
   int expResult = 25;
   int result = Square.square(number);
   assertEquals(expResult, result);
 }
 /** Test of square method, of class Square. */
 @Test
 public void testSquare_input_zero() {
   System.out.println("square of 0");
   int number = 0;
   int expResult = 0;
   int result = Square.square(number);
   assertEquals(expResult, result);
 }
 /** Test of square method, of class Square. */
 @Test
 public void testSquare_input_is_3() {
   System.out.println("square of 3");
   int number = 3;
   int expResult = 9;
   int result = Square.square(number);
   assertEquals(expResult, result);
 }