1c6612eabbe45c7c854776ef0dfb5205a828904e
[sdc/sdc-workflow-designer.git] /
1 /**\r
2  * Copyright (c) 2018 ZTE Corporation.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the Apache License, Version 2.0\r
5  * and the Eclipse Public License v1.0 which both accompany this distribution,\r
6  * and are available at http://www.eclipse.org/legal/epl-v10.html\r
7  * and http://www.apache.org/licenses/LICENSE-2.0\r
8  *\r
9  * Contributors:\r
10  *     ZTE - initial API and implementation and/or initial documentation\r
11  */\r
12 package org.onap.sdc.workflowdesigner.resources.entity;\r
13 \r
14 import static org.junit.Assert.*;\r
15 \r
16 import java.util.HashMap;\r
17 import java.util.Map;\r
18 \r
19 import org.junit.After;\r
20 import org.junit.Before;\r
21 import org.junit.Test;\r
22 import org.onap.sdc.workflowdesigner.utils.JsonUtils;\r
23 \r
24 /**\r
25  *\r
26  */\r
27 public class ContentTest {\r
28 \r
29   /**\r
30    * @throws java.lang.Exception\r
31    */\r
32   @Before\r
33   public void setUp() throws Exception {}\r
34 \r
35   /**\r
36    * @throws java.lang.Exception\r
37    */\r
38   @After\r
39   public void tearDown() throws Exception {}\r
40 \r
41   @Test\r
42   public void test() {\r
43 //    String clazz = "clazz";\r
44     String script = "script";\r
45     String scriptFormat = "scriptFormat";\r
46     Map<String, InputOutput> inputs = new HashMap<String, InputOutput>();\r
47     Map<String, InputOutput> outputs = new HashMap<String, InputOutput>();\r
48     \r
49     Content c = new Content();\r
50 //    c.setClass(clazz);\r
51     c.setInputs(inputs);\r
52     c.setOutputs(outputs);\r
53     c.setScript(script);\r
54     c.setScriptFormat(scriptFormat);\r
55     \r
56 //    assertEquals(clazz, c.getClazz());\r
57     assertEquals(inputs, c.getInputs());\r
58     assertEquals(outputs, c.getOutputs());\r
59     assertEquals(script, c.getScript());\r
60     assertEquals(scriptFormat, c.getScriptFormat());\r
61   }\r
62   \r
63   @Test\r
64   public void testGson() {\r
65     String json = "{\r\n" + \r
66         "      \"class\": \"aaaa\",\r\n" + \r
67         "      \"inputs\": {}\r\n" + \r
68         "    }";\r
69     Content content = JsonUtils.fromJson(json, Content.class);\r
70     assertNotNull(content);\r
71   }\r
72 \r
73 }\r