Add dummy tests for hsregex module to fix jacoco

This commit is contained in:
Paul Schaub 2022-11-30 15:42:08 +01:00
parent 21f8ba8ccf
commit 766af27b02
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// 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"));
}
}

View File

@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
/**
* Regex interpreter implementation based on Henry Spencers Regular Expression library.
*
* @see <a href="https://www.rfc-editor.org/rfc/rfc4880#section-8">RFC4880 - §8. Regular Expressions</a>
*/
package org.pgpainless.algorithm;