From 8169db4bbdc87c999f716869e38dc609a684f8cf Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 30 Nov 2022 15:58:38 +0100 Subject: [PATCH] Add test for invalid regex --- .../src/test/java/org/pgpainless/algorithm/RegexTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pgpainless-core/src/test/java/org/pgpainless/algorithm/RegexTest.java b/pgpainless-core/src/test/java/org/pgpainless/algorithm/RegexTest.java index 0eafec9d..f1692569 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/algorithm/RegexTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/algorithm/RegexTest.java @@ -5,6 +5,7 @@ package org.pgpainless.algorithm; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.Stream; @@ -117,4 +118,10 @@ public class RegexTest { RegexInterpreterFactory.setInstance(before); } + + @ParameterizedTest + @MethodSource("provideRegexInterpreterFactories") + public void testInvalidRegex(RegexInterpreterFactory factory) { + assertThrows(IllegalArgumentException.class, () -> factory.instantiate("[ab")); + } }