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

Luis-v3, switched to JUnit 4 to get Maven unit tests running, code formatting #1017

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions libraries/bot-ai-luis-v3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -69,30 +75,16 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.6.0</version>
<scope>test</scope>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import java.util.List;

/**
* Request Body element to use when passing Dynamic lists to the Luis Service call.
* Request Body element to use when passing Dynamic lists to the Luis Service
* call.
*
*/
public class DynamicList {
Expand All @@ -20,7 +21,8 @@ public DynamicList() {

/**
* Initializes a new instance of the DynamicList class.
* @param entity Entity field.
*
* @param entity Entity field.
* @param requestLists List Elements to use when querying Luis Service.
*/
public DynamicList(String entity, List<ListElement> requestLists) {
Expand All @@ -36,6 +38,7 @@ public DynamicList(String entity, List<ListElement> requestLists) {

/**
* Gets the entity.
*
* @return Entity name.
*/
public String getEntity() {
Expand All @@ -44,6 +47,7 @@ public String getEntity() {

/**
* Sets the entity name.
*
* @param entity entity name.
*/
public void setEntity(String entity) {
Expand All @@ -52,6 +56,7 @@ public void setEntity(String entity) {

/**
* Gets the List.
*
* @return Element list of the Dynamic List.
*/
public List<ListElement> getList() {
Expand All @@ -60,6 +65,7 @@ public List<ListElement> getList() {

/**
* Sets the List.
*
* @param list Element list of the Dynamic List.
*/
public void setList(List<ListElement> list) {
Expand All @@ -68,6 +74,7 @@ public void setList(List<ListElement> list) {

/**
* Validate the object.
*
* @throws IllegalArgumentException on null or invalid values.
*/
public void validate() throws IllegalArgumentException {
Expand All @@ -76,7 +83,7 @@ public void validate() throws IllegalArgumentException {
throw new IllegalArgumentException("ExternalEntity requires an EntityName and EntityLength > 0");
}

for (ListElement e: list) {
for (ListElement e : list) {
e.validate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import com.fasterxml.jackson.databind.JsonNode;

/**
* Request Body element to use when passing External Entities to the Luis Service call.
* Request Body element to use when passing External Entities to the Luis
* Service call.
*
*/
public class ExternalEntity {
Expand All @@ -20,10 +21,12 @@ public ExternalEntity() {

/**
* Initializes a new instance of ExternalEntity.
* @param entity name of the entity to extend.
* @param start start character index of the predicted entity.
* @param length length of the predicted entity.
* @param resolution supplied custom resolution to return as the entity's prediction.
*
* @param entity name of the entity to extend.
* @param start start character index of the predicted entity.
* @param length length of the predicted entity.
* @param resolution supplied custom resolution to return as the entity's
* prediction.
*/
public ExternalEntity(String entity, int start, int length, JsonNode resolution) {
this.entity = entity;
Expand All @@ -35,11 +38,9 @@ public ExternalEntity(String entity, int start, int length, JsonNode resolution)
@JsonProperty(value = "entityName")
private String entity;


@JsonProperty(value = "startIndex")
private int start;


@JsonProperty(value = "entityLength")
private int length = -1;

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

/**
* Gets the start character index of the predicted entity.
*
* @return start character index of the predicted entity.
*/
public int getStart() {
Expand All @@ -56,6 +58,7 @@ public int getStart() {

/**
* Sets the start character index of the predicted entity.
*
* @param start character index of the predicted entity.
*/
public void setStart(int start) {
Expand All @@ -64,6 +67,7 @@ public void setStart(int start) {

/**
* Gets the name of the entity to extend.
*
* @return name of the entity to extend.
*/
public String getEntity() {
Expand All @@ -72,6 +76,7 @@ public String getEntity() {

/**
* Sets the name of the entity to extend.
*
* @param entity name of the entity to extend.
*/
public void setEntity(String entity) {
Expand All @@ -80,6 +85,7 @@ public void setEntity(String entity) {

/**
* Gets the length of the predicted entity.
*
* @return length of the predicted entity.
*/
public int getLength() {
Expand All @@ -88,6 +94,7 @@ public int getLength() {

/**
* Sets the length of the predicted entity.
*
* @param length of the predicted entity.
*/
public void setLength(int length) {
Expand All @@ -96,6 +103,7 @@ public void setLength(int length) {

/**
* Gets a user supplied custom resolution to return as the entity's prediction.
*
* @return custom resolution to return as the entity's prediction.
*/
public JsonNode getResolution() {
Expand All @@ -104,6 +112,7 @@ public JsonNode getResolution() {

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

/**
* Validate the object.
*
* @throws IllegalArgumentException on null or invalid values
*/
public void validate() throws IllegalArgumentException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public ListElement() {

/**
* Initializes a new instance of the ListElement class.
*
* @param canonicalForm The canonical form of the sub-list.
* @param synonyms The synonyms of the canonical form.
* @param synonyms The synonyms of the canonical form.
*/
public ListElement(String canonicalForm, List<String> synonyms) {
this.canonicalForm = canonicalForm;
Expand All @@ -45,6 +46,7 @@ public ListElement(String canonicalForm, List<String> synonyms) {

/**
* Gets the canonical form of the sub-list.
*
* @return String canonical form of the sub-list.
*/
public String getCanonicalForm() {
Expand All @@ -53,6 +55,7 @@ public String getCanonicalForm() {

/**
* Sets the canonical form of the sub-list.
*
* @param canonicalForm the canonical form of the sub-list.
*/
public void setCanonicalForm(String canonicalForm) {
Expand All @@ -61,6 +64,7 @@ public void setCanonicalForm(String canonicalForm) {

/**
* Gets the synonyms of the canonical form.
*
* @return the synonyms List of the canonical form.
*/
public List<String> getSynonyms() {
Expand All @@ -69,6 +73,7 @@ public List<String> getSynonyms() {

/**
* Sets the synonyms of the canonical form.
*
* @param synonyms List of synonyms of the canonical form.
*/
public void setSynonyms(List<String> synonyms) {
Expand All @@ -77,6 +82,7 @@ public void setSynonyms(List<String> synonyms) {

/**
* Validate the object.
*
* @throws IllegalArgumentException if canonicalForm is null.
*/
public void validate() throws IllegalArgumentException {
Expand Down
Loading