Add test for invalid regex

This commit is contained in:
Paul Schaub 2022-11-30 15:58:38 +01:00
parent 766af27b02
commit 8169db4bbd
1 changed files with 7 additions and 0 deletions

View File

@ -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"));
}
}