From 766af27b0241865ec9d0f7b36b7c0ac586171206 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 30 Nov 2022 15:42:08 +0100 Subject: [PATCH] Add dummy tests for hsregex module to fix jacoco --- .../HSRegexInterpreterFactoryTest.java | 24 +++++++++++++++++++ .../pgpainless/algorithm/package-info.java | 10 ++++++++ 2 files changed, 34 insertions(+) create mode 100644 hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java create mode 100644 hsregex/src/test/java/org/pgpainless/algorithm/package-info.java diff --git a/hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java b/hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java new file mode 100644 index 00000000..e203a8dc --- /dev/null +++ b/hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: 2022 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +package org.pgpainless.algorithm; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class HSRegexInterpreterFactoryTest { + + @Test + public void dummyRegexTest() { + HSRegexInterpreterFactory factory = new HSRegexInterpreterFactory(); + RegexInterpreterFactory.setInstance(factory); + Regex regex = RegexInterpreterFactory.create("Alice|Bob"); + + assertTrue(regex.matches("Alice")); + assertTrue(regex.matches("Bob")); + assertFalse(regex.matches("Charlie")); + } +} diff --git a/hsregex/src/test/java/org/pgpainless/algorithm/package-info.java b/hsregex/src/test/java/org/pgpainless/algorithm/package-info.java new file mode 100644 index 00000000..5dc78706 --- /dev/null +++ b/hsregex/src/test/java/org/pgpainless/algorithm/package-info.java @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2022 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Regex interpreter implementation based on Henry Spencers Regular Expression library. + * + * @see RFC4880 - ยง8. Regular Expressions + */ +package org.pgpainless.algorithm;