2 * Žluťoučký kůň je naše hříbátko.
3 * and open the template in the editor.
8 import junit.framework.TestCase;
12 * @author Jaroslav Tulach <jtulach@netbeans.org>
14 public class FactorialTest extends TestCase {
16 public FactorialTest(String testName) {
21 protected void setUp() throws Exception {
26 protected void tearDown() throws Exception {
30 public void testFactorial3() {
31 assertEquals(6, Factorial.factorial(3));
34 public void testFactorial4() {
35 assertEquals(24, Factorial.factorial(4));
38 public void testFactorial5() {
39 assertEquals(120, Factorial.factorial(5));
42 /** Class showing inventive, non-expected use of
43 * Arithmetica methods to do multiplication instead of
46 //BEGIN: design.composition.arith.factorial
47 public static final class Factorial extends Arithmetica {
48 public static int factorial(int n) {
49 return new Factorial().sumRange(1, n);
52 public int sumTwo(int one, int second) {
56 //END: design.composition.arith.factorial