Skip to content

Commit

Permalink
Remove old dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoepics committed Jan 17, 2024
1 parent dc345da commit 1f24327
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 89 deletions.
32 changes: 6 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down Expand Up @@ -194,20 +188,6 @@
</execution>
</executions>
</plugin>
<!-- Attach source jars-->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-source</id>
<phase>compile</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Sign artifacts for uploading to maven central -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -222,12 +202,12 @@
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
Expand Down
13 changes: 7 additions & 6 deletions src/test/java/io/github/brenoepics/at4j/AT4JTest.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package io.github.brenoepics.at4j;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Field;
import org.junit.Test;

public class AT4JTest {
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

class AT4JTest {

@Test
public void testVersionFields() throws NoSuchFieldException, IllegalAccessException {
void testVersionFields() throws NoSuchFieldException, IllegalAccessException {
Field versionField = AT4J.class.getDeclaredField("VERSION");
versionField.setAccessible(true);
String version = (String) versionField.get(null);
Expand All @@ -27,7 +28,7 @@ public void testVersionFields() throws NoSuchFieldException, IllegalAccessExcept
}

@Test
public void testAzureTranslatorApiVersion() {
void testAzureTranslatorApiVersion() {
assertEquals("3.0", AT4J.AZURE_TRANSLATOR_API_VERSION);
}
}
26 changes: 13 additions & 13 deletions src/test/java/io/github/brenoepics/at4j/AzureApiTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.github.brenoepics.at4j;

import static org.junit.Assert.*;

import io.github.brenoepics.at4j.azure.BaseURL;
import io.github.brenoepics.at4j.azure.lang.Language;
import io.github.brenoepics.at4j.data.request.AvailableLanguagesParams;
Expand All @@ -14,24 +12,26 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;


public class AzureApiTest {
class AzureApiTest {
@Test
public void BuildNullKey() {
void BuildNullKey() {
AzureApiBuilder builder = new AzureApiBuilder();
assertThrows("Subscription key cannot be null", NullPointerException.class, builder::build);
assertThrows(NullPointerException.class, builder::build, "Subscription key cannot be null");
}

@Test
public void buildApi() {
void buildApi() {
AzureApi api = new AzureApiBuilder().setKey("test").region("test").build();
assertNotNull(api);
api.disconnect();
}

@Test
public void getLanguages() {
void getLanguages() {
AzureApi api =
new AzureApiBuilder().baseURL(BaseURL.GLOBAL).setKey("test").region("test").build();

Expand All @@ -43,7 +43,7 @@ public void getLanguages() {
}

@Test
public void getLanguagesEmptyKey() {
void getLanguagesEmptyKey() {
AzureApi api = new AzureApiBuilder().baseURL(BaseURL.GLOBAL).setKey("").region("test").build();

CompletableFuture<Optional<Collection<Language>>> languages =
Expand All @@ -53,7 +53,7 @@ public void getLanguagesEmptyKey() {
}

@Test
public void getLanguagesEmptySourceLanguage() {
void getLanguagesEmptySourceLanguage() {
AzureApi api =
new AzureApiBuilder().baseURL(BaseURL.GLOBAL).setKey("test").region("test").build();

Expand All @@ -64,7 +64,7 @@ public void getLanguagesEmptySourceLanguage() {
}

@Test
public void translateEmptyKey() {
void translateEmptyKey() {
AzureApi api = new AzureApiBuilder().baseURL(BaseURL.GLOBAL).setKey("").region("test").build();

TranslateParams params = new TranslateParams("test", List.of("pt")).setSourceLanguage("en");
Expand All @@ -74,7 +74,7 @@ public void translateEmptyKey() {
}

@Test
public void translateEmptyText() {
void translateEmptyText() {
AzureApi api = new AzureApiBuilder().baseURL(BaseURL.GLOBAL).setKey("test").build();

TranslateParams params = new TranslateParams("", List.of("pt")).setSourceLanguage("en");
Expand All @@ -85,7 +85,7 @@ public void translateEmptyText() {
}

@Test
public void translateEmptySourceLanguage() {
void translateEmptySourceLanguage() {
AzureApi api = new AzureApiBuilder().baseURL(BaseURL.GLOBAL).setKey("test").build();

TranslateParams params = new TranslateParams("", List.of("pt")).setTargetLanguages("pt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void returnsEmptyOnInvalidInput() {
.whenComplete(
(response, throwable) -> {
if (throwable != null) {
assertTrue(throwable instanceof AzureException);
assertInstanceOf(AzureException.class, throwable);
assertEquals("Text is required", throwable.getMessage());
}
});
Expand Down

This file was deleted.

0 comments on commit 1f24327

Please sign in to comment.