@Test public void whenCalculateFactorialOfFourThenResultTwentyFour() { Factorial factorial = new Factorial(4); assertThat(factorial.calculate(), is(24L)); }
public long calculate() { long result = 1; if (this.n >= 0) { for (int i = 1; i <= this.n; i++) { result *= i; } } else { System.out.println("Non positive number"); result = 0; } return result; }
Factorial { public long calculate() { long result = 1; if (this.n >= 0) { for (int i = 1; i <= this.n; i++) { result *= i; } } else { System.out.println("Non positive number"); result = 0; } return result; } }
Factorial { public long calculate() { long result = 1; if (this.n >= 0) { for (int i = 1; i <= this.n; i++) { result *= i; } } else { System.out.println("Non positive number"); result = 0; } return result; } Factorial(int n); }
Factorial { public long calculate() { long result = 1; if (this.n >= 0) { for (int i = 1; i <= this.n; i++) { result *= i; } } else { System.out.println("Non positive number"); result = 0; } return result; } Factorial(int n); long calculate(); }
Factorial { public long calculate() { long result = 1; if (this.n >= 0) { for (int i = 1; i <= this.n; i++) { result *= i; } } else { System.out.println("Non positive number"); result = 0; } return result; } Factorial(int n); long calculate();  }