1
2
3
4
5
6
7
8
9
10 package org.mule.module.json.transformers;
11
12 import org.mule.tck.AbstractMuleTestCase;
13
14
15 public class JsonStringTestCase extends AbstractMuleTestCase
16 {
17 public static final String TEST_JSON_MESSAGE = "{\"data\" : {\"value1\" : \"foo\", \"value2\" : \"bar\"}, \"replyTo\" : \"/response\"}";
18
19
20
21
22 public void testTryConvertJsonStringToJsonString() throws Exception
23 {
24 ObjectToJson transformer = createObject(ObjectToJson.class);
25 Object result = transformer.transform(TEST_JSON_MESSAGE);
26 assertNotNull(result);
27 assertEquals(TEST_JSON_MESSAGE, result);
28 }
29
30
31 public void testTryConvertJsonStringToJustString() throws Exception
32 {
33 ObjectToJson transformer = createObject(ObjectToJson.class);
34
35 assertEquals("\"Hello\"", transformer.transform("Hello"));
36 }
37 }