View Javadoc

1   /*
2    * $Id: HttpBadEncodingFunctionalTestCase.java 22518 2011-07-22 07:00:22Z claude.mamo $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.transport.http.functional;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.transport.http.HttpConnector;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertNotNull;
20  
21  public class HttpBadEncodingFunctionalTestCase extends HttpEncodingFunctionalTestCase
22  {
23      public HttpBadEncodingFunctionalTestCase(ConfigVariant variant, String configResources)
24      {
25          super(variant, configResources);
26      }
27  
28      @Override
29      public void testSend() throws Exception
30      {
31          MuleClient client = new MuleClient(muleContext);
32          
33          // Send as bytes so that the StringRequestEntity isn't used. If it is used
34          // it will throw an exception and stop us from testing the server side.
35          DefaultMuleMessage msg = new DefaultMuleMessage(TEST_MESSAGE.getBytes(), muleContext);
36          msg.setEncoding("UTFF-912");
37          MuleMessage reply = client.send("clientEndpoint", msg);
38          assertNotNull(reply);
39          assertEquals("500", reply.<Object>getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY));
40          assertNotNull(reply.getExceptionPayload());
41      }
42  
43  }