1 |
package com.instantiations.example.customer; |
2 |
|
3 |
/** |
4 |
* The class <code>CustomerUsage</code> exists to show how the test code |
5 |
* generator makes use of factory classes to create instances of objects. |
6 |
* @author Donna Devon |
7 |
*/ |
8 |
public class CustomerUsage |
9 |
{ |
10 |
public static String getFoo(Customer customer) |
11 |
{ |
12 |
if (customer.getName().equals("John Doe")) { |
13 |
return "bar"; |
14 |
} |
15 |
if (customer.getZip().equals("37")) { |
16 |
return "hello"; |
17 |
} |
18 |
return "foo"; |
19 |
} |
20 |
|
21 |
public static Customer makeCustomer(int a, String b) |
22 |
{ |
23 |
if (a == 1) { |
24 |
return null; |
25 |
} |
26 |
if (b.startsWith("z")) { |
27 |
return new Customer("Sam", "99999"); |
28 |
} |
29 |
return new Customer(b, Integer.toString(a)); |
30 |
} |
31 |
} |