Skip to content

Commit

Permalink
Merge pull request #21 from embulk/use-junit5
Browse files Browse the repository at this point in the history
Use JUnit 5 to test
  • Loading branch information
dmikurube authored Jun 29, 2023
2 parents 077994c + 5edd62f commit 3428732
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ dependencies {

testImplementation "org.embulk:embulk-spi:0.11"
testImplementation "org.msgpack:msgpack-core:0.8.24"
testImplementation "junit:junit:4.13.2"

testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.3"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.3"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.3"
}

javadoc {
Expand Down Expand Up @@ -173,6 +177,7 @@ signing {
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
Expand Down
16 changes: 9 additions & 7 deletions src/test/java/org/embulk/util/json/TestJsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@

package org.embulk.util.json;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.msgpack.value.Value;
import org.msgpack.value.ValueFactory;

Expand All @@ -41,10 +42,11 @@ public void testString() throws Exception {
assertEquals("foobar", msgpackValue.asStringValue().toString());
}

@Test(expected = JsonParseException.class)
public void testStringUnquoted() throws Exception {
final JsonParser parser = new JsonParser();
parser.parse("foobar");
assertThrows(JsonParseException.class, () -> {
parser.parse("foobar");
});
}

@Test
Expand Down

0 comments on commit 3428732

Please sign in to comment.