From a64d35cb8c099ec5d48185711866f306de9a1b6f Mon Sep 17 00:00:00 2001 From: Andrei Arlou Date: Fri, 8 Oct 2021 22:47:27 +0300 Subject: [PATCH] refactor: migration tests in credentials module from JUnit4 to JUnit5 (#756) (#761) --- .../com/google/auth/SigningExceptionTest.java | 23 +++++++++---------- credentials/pom.xml | 4 ++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/credentials/javatests/com/google/auth/SigningExceptionTest.java b/credentials/javatests/com/google/auth/SigningExceptionTest.java index 0d7aa48c5..e498924a3 100644 --- a/credentials/javatests/com/google/auth/SigningExceptionTest.java +++ b/credentials/javatests/com/google/auth/SigningExceptionTest.java @@ -31,29 +31,28 @@ package com.google.auth; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -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.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.auth.ServiceAccountSigner.SigningException; -import java.io.IOException; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class SigningExceptionTest { +class SigningExceptionTest { private static final String EXPECTED_MESSAGE = "message"; private static final RuntimeException EXPECTED_CAUSE = new RuntimeException(); @Test - public void constructor() { + void constructor() { SigningException signingException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); assertEquals(EXPECTED_MESSAGE, signingException.getMessage()); assertSame(EXPECTED_CAUSE, signingException.getCause()); } @Test - public void equals_true() throws IOException { + void equals_true() { SigningException signingException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); SigningException otherSigningException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); assertTrue(signingException.equals(otherSigningException)); @@ -61,7 +60,7 @@ public void equals_true() throws IOException { } @Test - public void equals_false_message() throws IOException { + void equals_false_message() { SigningException signingException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); SigningException otherSigningException = new SigningException("otherMessage", EXPECTED_CAUSE); assertFalse(signingException.equals(otherSigningException)); @@ -69,7 +68,7 @@ public void equals_false_message() throws IOException { } @Test - public void equals_false_cause() throws IOException { + void equals_false_cause() { SigningException signingException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); SigningException otherSigningException = new SigningException("otherMessage", new RuntimeException()); @@ -78,7 +77,7 @@ public void equals_false_cause() throws IOException { } @Test - public void hashCode_equals() throws IOException { + void hashCode_equals() { SigningException signingException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); SigningException otherSigningException = new SigningException(EXPECTED_MESSAGE, EXPECTED_CAUSE); assertEquals(signingException.hashCode(), otherSigningException.hashCode()); diff --git a/credentials/pom.xml b/credentials/pom.xml index e7ebb44d7..9ead18aa2 100644 --- a/credentials/pom.xml +++ b/credentials/pom.xml @@ -50,8 +50,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api test