Remove JUnit 4 dependency from all modules except spring-test
This commit removes the JUnit 4 dependency from all modules except spring-test which provides explicit JUnit 4 support. This commit also includes the following. - migration from JUnit 4 assertions to JUnit Jupiter assertions in all Kotlin tests - migration from JUnit 4 assumptions in Spring's TestGroup support to JUnit Jupiter assumptions, based on org.opentest4j.TestAbortedException - introduction of a new TestGroups utility class than can be used from existing JUnit 4 tests in the spring-test module in order to perform assumptions using JUnit 4's Assume class See gh-23451
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.context.annotation
|
||||
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.jupiter.api.Assertions.assertNotNull
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.getBean
|
||||
import org.springframework.context.support.registerBean
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.context.annotation
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.fail
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.getBean
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.context.annotation
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.BeanFactory
|
||||
import org.springframework.beans.factory.getBean
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package org.springframework.context.support
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertNotNull
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.fail
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException
|
||||
import org.springframework.beans.factory.getBean
|
||||
@@ -28,7 +31,7 @@ import java.util.stream.Collectors
|
||||
|
||||
@Suppress("UNUSED_EXPRESSION")
|
||||
class BeanDefinitionDslTests {
|
||||
|
||||
|
||||
@Test
|
||||
fun `Declare beans with the functional Kotlin DSL`() {
|
||||
val beans = beans {
|
||||
@@ -193,12 +196,12 @@ class BeanDefinitionDslTests {
|
||||
|
||||
try {
|
||||
context.getBean<Foo>()
|
||||
fail()
|
||||
fail("should have thrown an Exception")
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
try {
|
||||
context.getBean<FooFoo>()
|
||||
fail()
|
||||
fail("should have thrown an Exception")
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.context.support
|
||||
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.jupiter.api.Assertions.assertNotNull
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.getBean
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user