Skip to content

Commit

Permalink
Fix Test package
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoepics committed Jan 11, 2024
1 parent 79cfa6a commit 138ddc3
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tech.brenoepic.at4j;

import okhttp3.OkHttpClient;
import org.junit.Test;
import tech.brenoepic.at4j.AzureApi;
import tech.brenoepic.at4j.AzureApiBuilder;
import tech.brenoepic.at4j.azure.BaseURL;
import tech.brenoepic.at4j.azure.lang.Language;
import tech.brenoepic.at4j.data.request.AvailableLanguagesParams;
Expand All @@ -16,9 +16,8 @@
import static org.junit.Assert.*;


public class AzureApiTests {

AzureApi api;
public class AzureApiTest {


@Test
public void BuildNullKey() {
Expand All @@ -34,7 +33,7 @@ public void BuildNullHttpClient() {

@Test
public void buildApi() {
api = new AzureApiBuilder().setSubscriptionKey("test").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();
AzureApi api = new AzureApiBuilder().setSubscriptionKey("test").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();
assertNotNull(api);
api.getThreadPool().getExecutorService().shutdown();
}
Expand All @@ -52,7 +51,7 @@ public void getLanguages() {

@Test
public void getLanguagesEmptyKey() {
api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();
AzureApi api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();

CompletableFuture<Optional<Collection<Language>>> languages = api.getAvailableLanguages(new AvailableLanguagesParams());
languages.whenComplete((s, throwable) -> assertNull(throwable));
Expand All @@ -61,7 +60,7 @@ public void getLanguagesEmptyKey() {

@Test
public void getLanguagesEmptySourceLanguage() {
api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("test").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();
AzureApi api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("test").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();

CompletableFuture<Optional<Collection<Language>>> languages = api.getAvailableLanguages(new AvailableLanguagesParams());
languages.whenComplete((s, throwable) -> assertNull(throwable));
Expand All @@ -70,7 +69,7 @@ public void getLanguagesEmptySourceLanguage() {

@Test
public void translateEmptyKey() {
api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();
AzureApi api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("").setSubscriptionRegion("test").setOkHttpClient(new OkHttpClient()).build();

TranslateParams params = new TranslateParams("test").setSourceLanguage("en").setTargetLanguages("pt");
CompletableFuture<Optional<TranslationResponse>> translation = api.translate(params);
Expand All @@ -80,7 +79,7 @@ public void translateEmptyKey() {

@Test
public void translateEmptyText() {
api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("test").setOkHttpClient(new OkHttpClient()).build();
AzureApi api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("test").setOkHttpClient(new OkHttpClient()).build();

TranslateParams params = new TranslateParams("").setSourceLanguage("en").setTargetLanguages("pt");
CompletableFuture<Optional<TranslationResponse>> translation = api.translate(params);
Expand All @@ -91,7 +90,7 @@ public void translateEmptyText() {

@Test
public void translateEmptySourceLanguage() {
api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("test").setOkHttpClient(new OkHttpClient()).build();
AzureApi api = new AzureApiBuilder().setBaseURL(BaseURL.GLOBAL).setSubscriptionKey("test").setOkHttpClient(new OkHttpClient()).build();

TranslateParams params = new TranslateParams("").setTargetLanguages("pt");
CompletableFuture<Optional<TranslationResponse>> translation = api.translate(params);
Expand Down

0 comments on commit 138ddc3

Please sign in to comment.