1
2
3
4
5
6
7
8
9
10
11 package org.mule.example.scripting;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15
16 public abstract class AbstractDollarsScriptingExampleTestCase extends AbstractScriptingExampleTestCase
17 {
18 protected String getCurrency()
19 {
20 return "USD";
21 }
22
23 public void testChangeAlgorithm() throws Exception
24 {
25 MuleClient client = new MuleClient();
26 MuleMessage reply = client.send("vm://input", new Double(1.18), null);
27
28 assertNotNull(reply);
29 assertNotNull(reply.getPayload());
30 assertEquals("[4 quarters, 1 dimes, 1 nickels, 3 pennies]", reply.getPayloadAsString());
31 }
32
33 public void testAccumulator() throws Exception
34 {
35 MuleClient client = new MuleClient();
36 client.send("vm://input", new Double(0.09), null);
37 client.send("vm://input", new Double(0.09), null);
38 MuleMessage reply = client.send("vm://input", new Double(1.00), null);
39
40 assertNotNull(reply);
41 assertNotNull(reply.getPayload());
42 assertEquals("[4 quarters, 1 dimes, 1 nickels, 3 pennies]", reply.getPayloadAsString());
43 }
44 }