1   /*
2    * $Id: AbstractPoundsScriptingExampleTestCase.java 11747 2008-05-14 04:26:15Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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  }