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 AbstractPoundsScriptingExampleTestCase extends AbstractScriptingExampleTestCase
17 {
18 protected String getCurrency()
19 {
20 return "GBP";
21 }
22
23 public void testChangeAlgorithm() throws Exception
24 {
25 MuleClient client = new MuleClient();
26 MuleMessage reply = client.send("vm://input", new Double(3.88), null);
27
28 assertNotNull(reply);
29 assertNotNull(reply.getPayload());
30 assertEquals("[1 two_pounds, 1 pounds, 1 fifty_pence, 1 twenty_pence, 1 ten_pence, 1 five_pence, 1 two_pence, 1 pennies]", reply.getPayloadAsString());
31 }
32
33 public void testAccumulator() throws Exception
34 {
35 MuleClient client = new MuleClient();
36 client.send("vm://input", new Double(1.08), null);
37 client.send("vm://input", new Double(1.80), null);
38 MuleMessage reply = client.send("vm://input", new Double(1.00), null);
39
40 assertNotNull(reply);
41 assertNotNull(reply.getPayload());
42 assertEquals("[1 two_pounds, 1 pounds, 1 fifty_pence, 1 twenty_pence, 1 ten_pence, 1 five_pence, 1 two_pence, 1 pennies]", reply.getPayloadAsString());
43 }
44 }