Esempio n. 1
0
  @Test
  public void test() {
    // fail("Not yet implemented");

    int data = obj.calculate(3, 24);
    assertEquals(data, 27);
    assertNotNull(data);
  }
 @Test
 public void graterThan1000isIgnored() throws Exception {
   assertEquals(calculator.calculate("1,1,1001"), 2);
 }
 @Test(expected = Exception.class)
 public void negativeReturnsException() throws Exception {
   calculator.calculate("-1");
 }
 @Test
 public void threeNumbersDelimitedBothWayReturnsSum() throws Exception {
   assertEquals(calculator.calculate("1,2,3"), 6);
 }
 @Test
 public void twoNumbersNewLineDelimitedReturnSum() throws Exception {
   assertEquals(calculator.calculate("1\n2"), 3);
 }
 @Test
 public void twoNumbersReturnsSum() throws Exception {
   assertEquals(calculator.calculate("1,2"), 3);
 }
 @Test
 public void singleValueIsReplied() throws Exception {
   assertEquals(calculator.calculate("1"), 1);
 }
 @Test
 public void emptyStringReturnsZero() throws Exception {
   assertEquals(calculator.calculate(""), 0);
 }