コード例 #1
0
  @Test
  public void test3() throws Throwable {
    Rational rational0 = new Rational((-1L), (-1L));
    try {
      rational0.add((-3224L));
      fail("Expecting exception: NumberFormatException");

    } catch (NumberFormatException e) {
      //
      // Cannot create a Rational object with zero as the denominator
      //
    }
  }
コード例 #2
0
  /**
   * OVERVIEW: The test case "test3" covers around 1.0% (low percentage) of statements in "Rational"
   */
  @Test
  public void test3() throws Throwable {
    // The test case instantiates a "Rational" with numerator equal to -6L,
    // and denominator equal to 231L.
    // The execution of this constructor implicitly covers the following 1
    // conditions:
    // - the condition " denominator equals to 0L" is FALSE;
    Rational rational0 = new Rational((-6L), 231L);
    try {
      // The next method call the add long integer -66L to rational0

      // FIXME: rational0 value was not updated
      rational0 = rational0.add((-66L));
      // FIXME: this test says that we cannot add any number to a Rationale
      // fail("Expecting exception: NumberFormatException");

      assertEquals(-66.02597402597402, rational0.doubleValue(), 0.01D);

    } catch (NumberFormatException e) {
      //
      // Cannot create a Rational object with zero as the denominator
      //
    }
  }