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