* Remove testData to be renamed

* Rename testData to testdata in order to be consistent with other Java libraries

* Fix typo in javadoc

* Consistency of StringUtils

* Make props as final

* Update property from 0.4 to 0.42
This commit is contained in:
Martin Battaglino 2021-05-27 15:13:01 -03:00 коммит произвёл GitHub
Родитель 40094f92ab
Коммит c17025014b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
24 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -33,7 +33,6 @@ import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
@ -91,15 +90,15 @@ public class QnAMaker implements QnAMakerClient, TelemetryQnAMaker {
}
this.endpoint = withEndpoint;
if (Strings.isNullOrEmpty(this.endpoint.getKnowledgeBaseId())) {
if (StringUtils.isBlank(this.endpoint.getKnowledgeBaseId())) {
throw new IllegalArgumentException("knowledgeBaseId");
}
if (Strings.isNullOrEmpty(this.endpoint.getHost())) {
if (StringUtils.isBlank(this.endpoint.getHost())) {
throw new IllegalArgumentException("host");
}
if (Strings.isNullOrEmpty(this.endpoint.getEndpointKey())) {
if (StringUtils.isBlank(this.endpoint.getEndpointKey())) {
throw new IllegalArgumentException("endpointKey");
}
@ -222,7 +221,7 @@ public class QnAMaker implements QnAMakerClient, TelemetryQnAMaker {
return Async.completeExceptionally(new IllegalArgumentException("Activity type is not a message"));
}
if (Strings.isNullOrEmpty(turnContext.getActivity().getText())) {
if (StringUtils.isBlank(turnContext.getActivity().getText())) {
return Async.completeExceptionally(new IllegalArgumentException("Null or empty text"));
}

Просмотреть файл

@ -19,7 +19,7 @@ public class FeedbackRecord {
private Integer qnaId;
/**
* Gets the feedback recod's user ID.
* Gets the feedback record's user ID.
*
* @return The user ID.
*/
@ -28,7 +28,7 @@ public class FeedbackRecord {
}
/**
* Sets the feedback recod's user ID.
* Sets the feedback record's user ID.
*
* @param withUserId The user ID.
*/

Просмотреть файл

@ -14,11 +14,11 @@ import javax.annotation.Nullable;
* Class to bind activities.
*/
public class BindToActivity {
private Activity activity;
private final Activity activity;
/**
* Construct to bind an Activity.
*
*
* @param withActivity activity to bind.
*/
public BindToActivity(Activity withActivity) {
@ -37,7 +37,7 @@ public class BindToActivity {
/**
* Get the activity text.
*
*
* @return The activity text.
*/
public String toString() {

Просмотреть файл

@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
* Helper for HTTP requests.
*/
public class HttpRequestUtils {
private OkHttpClient httpClient = new OkHttpClient();
private final OkHttpClient httpClient = new OkHttpClient();
/**
* Execute Http request.

Просмотреть файл

@ -219,7 +219,7 @@ public class QnAMakerRecognizerTests {
private String readFileContent (String fileName) throws IOException {
String path = Paths.get("", "src", "test", "java", "com", "microsoft", "bot", "ai", "qna",
"testData", fileName).toAbsolutePath().toString();
"testdata", fileName).toAbsolutePath().toString();
File file = new File(path);
return FileUtils.readFileToString(file, "utf-8");
}

Просмотреть файл

@ -1109,7 +1109,7 @@ public class QnAMakerTests {
QnAMakerOptions allChangedRequestOptions = new QnAMakerOptions();
allChangedRequestOptions.setTop(2000);
allChangedRequestOptions.setScoreThreshold(0.4f);
allChangedRequestOptions.setScoreThreshold(0.42f);
allChangedRequestOptions.setStrictFilters(allChangedRequestOptionsFilters);
QnAMaker qna = new QnAMaker(qnAMakerEndpoint, noFiltersOptions);