Skip to content

Commit

Permalink
Tests for new exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kefirfromperm committed Jul 14, 2024
1 parent e06d07d commit 4440315
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/test/java/mina/core/MinaNegativeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import mina.subject.Simple;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.opentest4j.AssertionFailedError;
import org.opentest4j.IncompleteExecutionException;
import org.opentest4j.MultipleFailuresError;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -96,28 +98,35 @@ public void testThreeArgumentsMismatchType() {
@Test
public void testArgumentsComparisonLess() {
on(INFO).check(1, "2");
assertThrows(AssertionError.class, () -> log.info("test {}", 1));
assertThrows(AssertionFailedError.class, () -> log.info("test {}", 1));
assertAllCalled();
}

@Test
public void testArgumentsComparisonMore() {
on(INFO).check(1, "2");
assertThrows(AssertionError.class, () -> log.info("test {} {} {}", 1, "2", 3.));
assertThrows(AssertionFailedError.class, () -> log.info("test {} {} {}", 1, "2", 3.));
assertAllCalled();
}

@Test
public void testSingleArgumentMismatch() {
on(INFO).check(1, "2");
assertThrows(AssertionFailedError.class, () -> log.info("test {} {}", 1, "3"));
assertAllCalled();
}

@Test
public void testArgumentsMismatch() {
on(INFO).check(1, "2");
assertThrows(AssertionError.class, () -> log.info("test {} {}", 2, "3"));
assertThrows(MultipleFailuresError.class, () -> log.info("test {} {}", 2, "3"));
assertAllCalled();
}

@Test
public void testArgumentsTypeMismatch() {
on(INFO).check(1, "2");
assertThrows(AssertionError.class, () -> log.info("test {} {}", 1, 1));
assertThrows(AssertionFailedError.class, () -> log.info("test {} {}", 1, 1));
assertAllCalled();
}

Expand Down

0 comments on commit 4440315

Please sign in to comment.