Skip to content

Commit cbf859e

Browse files
added the first test as part of #10
1 parent c27294c commit cbf859e

File tree

1 file changed

+47
-0
lines changed
  • src/test/java/com/ibm/watson/developer_cloud/tradeoff_analytics/v1

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.ibm.watson.developer_cloud.tradeoff_analytics.v1;
17+
18+
import java.io.InputStream;
19+
20+
import org.junit.Assert;
21+
import org.junit.Test;
22+
23+
import com.ibm.watson.developer_cloud.WatsonServiceTest;
24+
import com.ibm.watson.developer_cloud.tradeoff_analytics.v1.model.Problem;
25+
import com.ibm.watson.developer_cloud.util.GsonSingleton;
26+
27+
/**
28+
* The Class TradeoffAnalyticsTest.
29+
*/
30+
public class ProblemTest {
31+
32+
/**
33+
* Test convert problem to json and vise versa
34+
*/
35+
@Test
36+
public void testJsonProblem() {
37+
InputStream in = this.getClass().getClassLoader().getResourceAsStream("problem.json");
38+
String problemJson = WatsonServiceTest.getStringFromInputStream(in);
39+
Problem problem = GsonSingleton.getGson().fromJson(problemJson, Problem.class);
40+
Assert.assertNotNull(problem.getSubject());
41+
Assert.assertNotNull(problem.getColumns());
42+
Assert.assertNotNull(problem.getOptions());
43+
Assert.assertNotNull(problem.getColumns().get(0));
44+
Assert.assertNotNull(problem.getOptions().get(0));
45+
}
46+
47+
}

0 commit comments

Comments
 (0)