1   /*
2    * $Id: AbstractDollarsScriptingExampleTestCase.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 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  }