Skip to content

Commit

Permalink
Try import 'Assert' instead of 'assertThrows'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Apr 24, 2024
1 parent ed16960 commit 28c80e1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Kitodo-API/src/test/java/org/kitodo/utils/GuardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

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

import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;

import org.junit.Assert;
import org.junit.Test;

public class GuardTest {
Expand All @@ -40,7 +40,7 @@ public void canCastShouldCastToSuperclass() {

@Test
public void canCastShouldNotMiscast() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
Object input = new ArrayList<File>();
Guard.canCast("input", input, String.class);
});
Expand All @@ -50,7 +50,7 @@ public void canCastShouldNotMiscast() {

@Test
public void isInRangeShouldFailBelowLowerBound() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
long dice = 0;
Guard.isInRange("dice", dice, 1, 6);
});
Expand Down Expand Up @@ -78,7 +78,7 @@ public void isInRangeShouldNotFailOnUpperBound() {

@Test
public void isInRangeShouldFailAboveUpperBound() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
long dice = 7;
Guard.isInRange("dice", dice, 1, 6);
});
Expand All @@ -93,7 +93,7 @@ public void isNotNullShouldNotFailForInitializedObjekt() {

@Test
public void isNotNullShouldFailForNullObjekt() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
Object object = null;
Guard.isNotNull("object", object);
});
Expand All @@ -114,7 +114,7 @@ public void isPositiveDoubleShouldNotFailForPositiveBoundary() {

@Test
public void isPositiveDoubleShouldFailForZero() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
double value = 0;
Guard.isPositive("value", value);
});
Expand All @@ -123,7 +123,7 @@ public void isPositiveDoubleShouldFailForZero() {

@Test
public void isPositiveDoubleShouldFailForNegative() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
double value = -299_792_458;
Guard.isPositive("value", value);
});
Expand All @@ -144,7 +144,7 @@ public void isPositiveLongShouldNotFailForPositiveLowerBound() {

@Test
public void isPositiveLongShouldFailForZero() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
long value = 0;
Guard.isPositive("value", value);
});
Expand All @@ -153,7 +153,7 @@ public void isPositiveLongShouldFailForZero() {

@Test
public void isPositiveLongShouldFailForNegative() {
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> {
IllegalArgumentException e = Assert.assertThrows(IllegalArgumentException.class, () -> {
long value = Long.MAX_VALUE + 1; // negative due to integer overflow
Guard.isPositive("value", value);
});
Expand Down

0 comments on commit 28c80e1

Please sign in to comment.