KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hanseltest > CoverExpression


1 package org.hanseltest;
2
3 /**
4  * Simple code to be covered bythe testcases.
5  * @author Niklas Mehner
6  */

7 public class CoverExpression {
8     
9     /**
10      * Simple method to test covering a 'not' expression
11      * @param b some boolean.
12      * @return !b
13      */

14     public boolean coverNot(boolean b) {
15         return !b;
16     }
17
18     /**
19      * Simple method to test covering an 'and' expression
20      * @param a some boolean.
21      * @param b some boolean.
22      * @return !b
23      */

24     public boolean coverAnd(boolean a, boolean b) {
25         return a && b;
26     }
27
28     /**
29      * Simple method to test covering an 'or' expression
30      * @param a some boolean.
31      * @param b some boolean.
32      * @return !b
33      */

34     public boolean coverOr(boolean a, boolean b) {
35         return a || b;
36     }
37
38     /**
39      * Simple method to test covering a complex expression
40      * @param a some boolean.
41      * @param b some boolean.
42      * @param c some boolean.
43      * @param d some boolean.
44      * @return !b
45      */

46     public boolean coverComplex(boolean a, boolean b, boolean c, boolean d) {
47         return (a && b) || (c && d);
48     }
49 }
50
Popular Tags