Skip to content

Commit 876ed59

Browse files
committed
test(Natural Language Understanding): Update unit test for new response info
1 parent aafed08 commit 876ed59

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414

1515

1616
import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig;
17-
import com.ibm.cloud.sdk.core.service.security.IamOptions;
1817
import com.ibm.watson.common.WatsonServiceUnitTest;
1918
import com.ibm.watson.natural_language_understanding.v1.model.AnalysisResults;
2019
import com.ibm.watson.natural_language_understanding.v1.model.AnalyzeOptions;
2120
import com.ibm.watson.natural_language_understanding.v1.model.CategoriesOptions;
2221
import com.ibm.watson.natural_language_understanding.v1.model.ConceptsOptions;
2322
import com.ibm.watson.natural_language_understanding.v1.model.DeleteModelOptions;
24-
import com.ibm.watson.natural_language_understanding.v1.model.DeleteModelResults;
2523
import com.ibm.watson.natural_language_understanding.v1.model.EmotionOptions;
2624
import com.ibm.watson.natural_language_understanding.v1.model.EntitiesOptions;
2725
import com.ibm.watson.natural_language_understanding.v1.model.Features;
@@ -112,6 +110,8 @@ public void testAnalyze() throws InterruptedException, FileNotFoundException {
112110
assertNotNull(analyzeResults.getEmotion());
113111
assertNotNull(analyzeResults.getConcepts());
114112
assertNotNull(analyzeResults.getCategories());
113+
assertEquals(analyzeResults.getCategories().get(0).getExplanation().getRelevantText().get(0).getText(),
114+
response.getCategories().get(0).getExplanation().getRelevantText().get(0).getText());
115115
assertNotNull(analyzeResults.getKeywords());
116116
assertNotNull(analyzeResults.getMetadata());
117117
assertNotNull(analyzeResults.getSemanticRoles());

natural-language-understanding/src/test/resources/natural_language_understanding/analyze.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,36 @@
1010
"categories": [
1111
{
1212
"score": 0.894113,
13-
"label": "/technology and computing/enterprise technology"
13+
"label": "/technology and computing/enterprise technology",
14+
"explanation": {
15+
"relevant_text": [
16+
{
17+
"text": "abcd"
18+
}
19+
]
20+
}
1421
},
1522
{
1623
"score": 0.877948,
17-
"label": "/business and industrial/business software"
24+
"label": "/business and industrial/business software",
25+
"explanation": {
26+
"relevant_text": [
27+
{
28+
"text": "efgh"
29+
}
30+
]
31+
}
1832
},
1933
{
2034
"score": 0.85497,
21-
"label": "/business and industrial/business operations/management/business process"
35+
"label": "/business and industrial/business operations/management/business process",
36+
"explanation": {
37+
"relevant_text": [
38+
{
39+
"text": "ijkl"
40+
}
41+
]
42+
}
2243
}
2344
],
2445
"concepts": [

0 commit comments

Comments
 (0)