-
Notifications
You must be signed in to change notification settings - Fork 184
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
Migrate servicetalk-buffer-api tests to JUnit 5 (#1568) #1592
Conversation
9240f42
to
c0f24d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make all test methods pkg private.
Since you are in there do you mind also making this small change,
the null check is not needed since the parent class does check for null.
diff --git a/servicetalk-buffer-api/src/testFixtures/java/io/servicetalk/buffer/api/Matchers.java b/servicetalk-buffer-api/src/testFixtures/java/io/servicetalk/buffer/api/Matchers.java
index 2db5f8c31..c95ac0819 100644
--- a/servicetalk-buffer-api/src/testFixtures/java/io/servicetalk/buffer/api/Matchers.java
+++ b/servicetalk-buffer-api/src/testFixtures/java/io/servicetalk/buffer/api/Matchers.java
@@ -43,9 +43,6 @@ public final class Matchers {
@Override
protected boolean matchesSafely(final CharSequence item) {
- if (item == null) {
- return false;
- }
return contentEquals(expected, item);
}
@kashike thanks for your contribution!!
The rest looks good to me.
servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/ReadOnlyByteBufferTest.java
Show resolved
Hide resolved
c0f24d9
to
4278998
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kashike, last change and we can merge it.
diff --git a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/AsciiBufferTest.java b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/AsciiBufferTest.java
index 0acc88708..8c248834c 100644
--- a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/AsciiBufferTest.java
+++ b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/AsciiBufferTest.java
@@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class AsciiBufferTest {
+class AsciiBufferTest {
@Test
void testHashCode() {
for (int i = 0; i < 1000; ++i) {
diff --git a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/BufferInputStreamTest.java b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/BufferInputStreamTest.java
index db31beb03..cccdaa7ff 100644
--- a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/BufferInputStreamTest.java
+++ b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/BufferInputStreamTest.java
@@ -25,7 +25,7 @@ import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-public class BufferInputStreamTest {
+class BufferInputStreamTest {
private static final String DATA = "12345";
private final InputStream is = new BufferInputStream(DEFAULT_RO_ALLOCATOR.fromAscii("12345"));
diff --git a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/CharSequencesTest.java b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/CharSequencesTest.java
index 449a8be71..b990d5e03 100644
--- a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/CharSequencesTest.java
+++ b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/CharSequencesTest.java
@@ -31,7 +31,7 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
-public class CharSequencesTest {
+class CharSequencesTest {
// Common strings
public static final String GZIP = "gzip";
diff --git a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/ReadOnlyByteBufferTest.java b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/ReadOnlyByteBufferTest.java
index bb6e52d79..af85b7ca4 100644
--- a/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/ReadOnlyByteBufferTest.java
+++ b/servicetalk-buffer-api/src/test/java/io/servicetalk/buffer/api/ReadOnlyByteBufferTest.java
@@ -25,7 +25,7 @@ import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
-public class ReadOnlyByteBufferTest {
+class ReadOnlyByteBufferTest {
@Test
void directFromString() {
String expectedString = "testing";
Motivation: - JUnit 5 leverages features from Java 8 or later, such as lambda functions, making tests more powerful and easier to maintain. - JUnit 5 has added some very useful new features for describing, organizing, and executing tests. For instance, tests get better display names and can be organized hierarchically. - JUnit 5 is organized into multiple libraries, so only the features you need are imported into your project. With build systems such as Maven and Gradle, including the right libraries is easy. - JUnit 5 can use more than one extension at a time, which JUnit 4 could not (only one runner could be used at a time). This means you can easily combine the Spring extension with other extensions (such as your own custom extension). Modifications: - Unit tests have been migrated from JUnit 4 to JUnit 5 Result: Module servicetalk-buffer-api now runs tests using JUnit 5
4278998
to
672db3f
Compare
Done @tkountis. |
🚀 |
Motivation:
Modifications:
Result:
Module servicetalk-buffer-api now runs tests using JUnit 5