Skip to content

Migrate deepl-test-app to JUnit 5 #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
47 changes: 21 additions & 26 deletions examples/maven/deepl-test-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -34,36 +34,31 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<excludedGroups>com.deepl.deepltestapp.annotation.IntegrationTest</excludedGroups>
</configuration>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>runIntegrationTests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<phase>integration-test</phase>
<configuration>
<includes>
<include>**/*</include>
</includes>
<groups>com.deepl.deepltestapp.annotation.IntegrationTest</groups>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<phase>integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,26 @@
package com.deepl.deepltestapp;

import com.deepl.api.*;
import com.deepl.deepltestapp.*;
import com.deepl.deepltestapp.annotation.IntegrationTest;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Assert.*;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;

/**
* Internal DeepL Integration Test
*/
@Category(IntegrationTest.class)
public class DeepLIntegrationTest extends TestCase {
public DeepLIntegrationTest(String testName) {
super(testName);
}

public static Test suite() {
return new TestSuite(DeepLIntegrationTest.class);
}
public class DeepLIntegrationTest {

/**
* Runs the hello world example. Requires a DeepL auth key via the DEEPL_AUTH_KEY
* environment variable.
*/
public void testApp() throws InterruptedException, DeepLException {
@Test
void testApp() throws InterruptedException, DeepLException {
String result = App.translateHelloWorld();
String[] wordsToCheck = {"Hello", "World"};
for (String wordToCheck : wordsToCheck) {
assertFalse(String.format("Expected translation to no longer contain the english %s, received %s",
wordToCheck, result), result.contains(wordToCheck)
assertFalse(result.contains(wordToCheck),
String.format("Expected translation to no longer contain the english %s, received %s", wordToCheck, result)
);
}
}
Expand Down