1 Reply Latest reply on Jun 18, 2010 2:02 PM by 800387

    Noob question in JUnit.

      Hello all.
      Starts to use JUnit in NetBeans 5.5. But can`t understand how it works.
      Have such simple code:
           * Test of isCloseTime method, of class stInterface.TestSettings.
          public void testIsCloseTime() {
              boolean expResult = true;
              boolean result = true;
              assertEquals(expResult, result);
              // TODO review the generated test code and remove the default call to fail.
              fail(expResult + " is not equal " + result);
      The push Alt+F6 for test starting and get:
      true is not equal true

      Please, expalain me, what I have done wrong?
        • 1. Re: Noob question in JUnit.
          The assertEquals passes (since true is equal to true). However, you have a line invoking fail right below. This will throw an AssertionError indicating the test has failed. Remove or comment out the line containing the fail invocation (as the auto-generated comments clue you to do).

          - Saish