Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 94e5eef

Browse files
authored
Luis-v3, switched to JUnit 4 to get Maven unit tests running, code formatting (#1017)
1 parent de1867d commit 94e5eef

File tree

15 files changed

+703
-693
lines changed

15 files changed

+703
-693
lines changed

libraries/bot-ai-luis-v3/pom.xml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
<dependency>
4949
<groupId>junit</groupId>
5050
<artifactId>junit</artifactId>
51+
<scope>test</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>org.mockito</groupId>
55+
<artifactId>mockito-core</artifactId>
56+
<scope>test</scope>
5157
</dependency>
5258
<dependency>
5359
<groupId>org.slf4j</groupId>
@@ -69,30 +75,16 @@
6975
<dependency>
7076
<groupId>com.squareup.okhttp3</groupId>
7177
<artifactId>okhttp</artifactId>
72-
<version>4.9.0</version>
73-
</dependency>
74-
<dependency>
75-
<groupId>org.json</groupId>
76-
<artifactId>json</artifactId>
77-
<version>20190722</version>
7878
</dependency>
7979
<dependency>
8080
<groupId>com.squareup.okhttp3</groupId>
8181
<artifactId>mockwebserver</artifactId>
82-
<version>4.9.0</version>
8382
<scope>test</scope>
8483
</dependency>
8584
<dependency>
86-
<groupId>org.junit.jupiter</groupId>
87-
<artifactId>junit-jupiter-params</artifactId>
88-
<version>5.7.0</version>
89-
<scope>test</scope>
90-
</dependency>
91-
<dependency>
92-
<groupId>org.mockito</groupId>
93-
<artifactId>mockito-junit-jupiter</artifactId>
94-
<version>3.6.0</version>
95-
<scope>test</scope>
85+
<groupId>org.json</groupId>
86+
<artifactId>json</artifactId>
87+
<version>20190722</version>
9688
</dependency>
9789
</dependencies>
9890

libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/DynamicList.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import java.util.List;
88

99
/**
10-
* Request Body element to use when passing Dynamic lists to the Luis Service call.
10+
* Request Body element to use when passing Dynamic lists to the Luis Service
11+
* call.
1112
*
1213
*/
1314
public class DynamicList {
@@ -20,7 +21,8 @@ public DynamicList() {
2021

2122
/**
2223
* Initializes a new instance of the DynamicList class.
23-
* @param entity Entity field.
24+
*
25+
* @param entity Entity field.
2426
* @param requestLists List Elements to use when querying Luis Service.
2527
*/
2628
public DynamicList(String entity, List<ListElement> requestLists) {
@@ -36,6 +38,7 @@ public DynamicList(String entity, List<ListElement> requestLists) {
3638

3739
/**
3840
* Gets the entity.
41+
*
3942
* @return Entity name.
4043
*/
4144
public String getEntity() {
@@ -44,6 +47,7 @@ public String getEntity() {
4447

4548
/**
4649
* Sets the entity name.
50+
*
4751
* @param entity entity name.
4852
*/
4953
public void setEntity(String entity) {
@@ -52,6 +56,7 @@ public void setEntity(String entity) {
5256

5357
/**
5458
* Gets the List.
59+
*
5560
* @return Element list of the Dynamic List.
5661
*/
5762
public List<ListElement> getList() {
@@ -60,6 +65,7 @@ public List<ListElement> getList() {
6065

6166
/**
6267
* Sets the List.
68+
*
6369
* @param list Element list of the Dynamic List.
6470
*/
6571
public void setList(List<ListElement> list) {
@@ -68,6 +74,7 @@ public void setList(List<ListElement> list) {
6874

6975
/**
7076
* Validate the object.
77+
*
7178
* @throws IllegalArgumentException on null or invalid values.
7279
*/
7380
public void validate() throws IllegalArgumentException {
@@ -76,7 +83,7 @@ public void validate() throws IllegalArgumentException {
7683
throw new IllegalArgumentException("ExternalEntity requires an EntityName and EntityLength > 0");
7784
}
7885

79-
for (ListElement e: list) {
86+
for (ListElement e : list) {
8087
e.validate();
8188
}
8289
}

libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/ExternalEntity.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import com.fasterxml.jackson.databind.JsonNode;
88

99
/**
10-
* Request Body element to use when passing External Entities to the Luis Service call.
10+
* Request Body element to use when passing External Entities to the Luis
11+
* Service call.
1112
*
1213
*/
1314
public class ExternalEntity {
@@ -20,10 +21,12 @@ public ExternalEntity() {
2021

2122
/**
2223
* Initializes a new instance of ExternalEntity.
23-
* @param entity name of the entity to extend.
24-
* @param start start character index of the predicted entity.
25-
* @param length length of the predicted entity.
26-
* @param resolution supplied custom resolution to return as the entity's prediction.
24+
*
25+
* @param entity name of the entity to extend.
26+
* @param start start character index of the predicted entity.
27+
* @param length length of the predicted entity.
28+
* @param resolution supplied custom resolution to return as the entity's
29+
* prediction.
2730
*/
2831
public ExternalEntity(String entity, int start, int length, JsonNode resolution) {
2932
this.entity = entity;
@@ -35,11 +38,9 @@ public ExternalEntity(String entity, int start, int length, JsonNode resolution)
3538
@JsonProperty(value = "entityName")
3639
private String entity;
3740

38-
3941
@JsonProperty(value = "startIndex")
4042
private int start;
4143

42-
4344
@JsonProperty(value = "entityLength")
4445
private int length = -1;
4546

@@ -48,6 +49,7 @@ public ExternalEntity(String entity, int start, int length, JsonNode resolution)
4849

4950
/**
5051
* Gets the start character index of the predicted entity.
52+
*
5153
* @return start character index of the predicted entity.
5254
*/
5355
public int getStart() {
@@ -56,6 +58,7 @@ public int getStart() {
5658

5759
/**
5860
* Sets the start character index of the predicted entity.
61+
*
5962
* @param start character index of the predicted entity.
6063
*/
6164
public void setStart(int start) {
@@ -64,6 +67,7 @@ public void setStart(int start) {
6467

6568
/**
6669
* Gets the name of the entity to extend.
70+
*
6771
* @return name of the entity to extend.
6872
*/
6973
public String getEntity() {
@@ -72,6 +76,7 @@ public String getEntity() {
7276

7377
/**
7478
* Sets the name of the entity to extend.
79+
*
7580
* @param entity name of the entity to extend.
7681
*/
7782
public void setEntity(String entity) {
@@ -80,6 +85,7 @@ public void setEntity(String entity) {
8085

8186
/**
8287
* Gets the length of the predicted entity.
88+
*
8389
* @return length of the predicted entity.
8490
*/
8591
public int getLength() {
@@ -88,6 +94,7 @@ public int getLength() {
8894

8995
/**
9096
* Sets the length of the predicted entity.
97+
*
9198
* @param length of the predicted entity.
9299
*/
93100
public void setLength(int length) {
@@ -96,6 +103,7 @@ public void setLength(int length) {
96103

97104
/**
98105
* Gets a user supplied custom resolution to return as the entity's prediction.
106+
*
99107
* @return custom resolution to return as the entity's prediction.
100108
*/
101109
public JsonNode getResolution() {
@@ -104,6 +112,7 @@ public JsonNode getResolution() {
104112

105113
/**
106114
* Sets External entities to be recognized in query.
115+
*
107116
* @param resolution custom resolution to return as the entity's prediction.
108117
*/
109118
public void setResolution(JsonNode resolution) {
@@ -112,6 +121,7 @@ public void setResolution(JsonNode resolution) {
112121

113122
/**
114123
* Validate the object.
124+
*
115125
* @throws IllegalArgumentException on null or invalid values
116126
*/
117127
public void validate() throws IllegalArgumentException {

libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/ListElement.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public ListElement() {
2222

2323
/**
2424
* Initializes a new instance of the ListElement class.
25+
*
2526
* @param canonicalForm The canonical form of the sub-list.
26-
* @param synonyms The synonyms of the canonical form.
27+
* @param synonyms The synonyms of the canonical form.
2728
*/
2829
public ListElement(String canonicalForm, List<String> synonyms) {
2930
this.canonicalForm = canonicalForm;
@@ -45,6 +46,7 @@ public ListElement(String canonicalForm, List<String> synonyms) {
4546

4647
/**
4748
* Gets the canonical form of the sub-list.
49+
*
4850
* @return String canonical form of the sub-list.
4951
*/
5052
public String getCanonicalForm() {
@@ -53,6 +55,7 @@ public String getCanonicalForm() {
5355

5456
/**
5557
* Sets the canonical form of the sub-list.
58+
*
5659
* @param canonicalForm the canonical form of the sub-list.
5760
*/
5861
public void setCanonicalForm(String canonicalForm) {
@@ -61,6 +64,7 @@ public void setCanonicalForm(String canonicalForm) {
6164

6265
/**
6366
* Gets the synonyms of the canonical form.
67+
*
6468
* @return the synonyms List of the canonical form.
6569
*/
6670
public List<String> getSynonyms() {
@@ -69,6 +73,7 @@ public List<String> getSynonyms() {
6973

7074
/**
7175
* Sets the synonyms of the canonical form.
76+
*
7277
* @param synonyms List of synonyms of the canonical form.
7378
*/
7479
public void setSynonyms(List<String> synonyms) {
@@ -77,6 +82,7 @@ public void setSynonyms(List<String> synonyms) {
7782

7883
/**
7984
* Validate the object.
85+
*
8086
* @throws IllegalArgumentException if canonicalForm is null.
8187
*/
8288
public void validate() throws IllegalArgumentException {

0 commit comments

Comments
 (0)