archrule to disallow JUnit 4, dependency exclude not possible as it's still needed for testcontainers
This commit is contained in:
parent
3de8b00672
commit
661f23e1e2
@ -81,6 +81,14 @@ public class ArchUnitTest {
|
||||
org.springframework.transaction.annotation.Transactional.class.getName(),
|
||||
javax.transaction.Transactional.class.getName()));
|
||||
|
||||
@ArchTest
|
||||
@SuppressWarnings("unused")
|
||||
public static final ArchRule doNotUseOrgJUnitTestAnnotation = noMethods()
|
||||
.should().beAnnotatedWith(org.junit.Test.class)
|
||||
.as("Use @%s instead of @%s." .formatted(
|
||||
org.junit.jupiter.api.Test.class.getName(),
|
||||
org.junit.Test.class.getName()));
|
||||
|
||||
@Test
|
||||
public void everythingShouldBeFreeOfCycles() {
|
||||
slices().matching("net.hostsharing.hsadminng.(*)..").should().beFreeOfCycles();
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.hostsharing.test;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.NestedExceptionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -115,7 +114,8 @@ public class JpaAttempt {
|
||||
if (expectedExceptionClass.isAssignableFrom(exception.getClass())) {
|
||||
return (E) exception;
|
||||
}
|
||||
throw new AssertionFailedError("expected " + expectedExceptionClass + " but got " + exception);
|
||||
fail("");
|
||||
throw new AssertionError("expected " + expectedExceptionClass + " but got " + exception);
|
||||
}
|
||||
|
||||
public Throwable caughtExceptionsRootCause() {
|
||||
|
Loading…
Reference in New Issue
Block a user