fix(test): JUnit tagging and coverage
This commit is contained in:
@@ -96,6 +96,7 @@ import org.junit.jupiter.params.provider.MethodSource;
|
|||||||
@Tag("cli")
|
@Tag("cli")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
@Tag("compile")
|
@Tag("compile")
|
||||||
|
@Tag("construction")
|
||||||
@Tag("slow")
|
@Tag("slow")
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
@DisplayName("Compile integration")
|
@DisplayName("Compile integration")
|
||||||
@@ -184,6 +185,11 @@ final class CompileIntegrationTest {
|
|||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("Remark-aware fixture workflow")
|
@DisplayName("Remark-aware fixture workflow")
|
||||||
|
@Tag("integration")
|
||||||
|
@Tag("cli")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("compile")
|
||||||
|
@Tag("construction")
|
||||||
final class RemarkAwareFixtureWorkflow {
|
final class RemarkAwareFixtureWorkflow {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,6 +312,11 @@ final class CompileIntegrationTest {
|
|||||||
@Nested
|
@Nested
|
||||||
@DisplayName("Bundled project dictionary workflows")
|
@DisplayName("Bundled project dictionary workflows")
|
||||||
@Tag("slow")
|
@Tag("slow")
|
||||||
|
@Tag("integration")
|
||||||
|
@Tag("cli")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("compile")
|
||||||
|
@Tag("construction")
|
||||||
final class BundledProjectDictionaryWorkflows {
|
final class BundledProjectDictionaryWorkflows {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import org.junit.jupiter.api.io.TempDir;
|
|||||||
@Tag("cli")
|
@Tag("cli")
|
||||||
@Tag("compile")
|
@Tag("compile")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
|
@Tag("construction")
|
||||||
@DisplayName("Compile")
|
@DisplayName("Compile")
|
||||||
class CompileTest {
|
class CompileTest {
|
||||||
|
|
||||||
@@ -178,6 +179,11 @@ class CompileTest {
|
|||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("argument validation")
|
@DisplayName("argument validation")
|
||||||
|
@Tag("integration")
|
||||||
|
@Tag("cli")
|
||||||
|
@Tag("compile")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
class ArgumentValidationTest {
|
class ArgumentValidationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("diacritic")
|
@Tag("diacritic")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
|
@Tag("normalization")
|
||||||
@DisplayName("DiacriticStripper")
|
@DisplayName("DiacriticStripper")
|
||||||
class DiacriticStripperTest {
|
class DiacriticStripperTest {
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ import org.junit.jupiter.api.io.TempDir;
|
|||||||
@Tag("fuzz")
|
@Tag("fuzz")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
|
@Tag("determinism")
|
||||||
class FuzzStemmerAndTrieCompilationTest {
|
class FuzzStemmerAndTrieCompilationTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ import org.junit.jupiter.api.io.TempDir;
|
|||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("parser")
|
@Tag("parser")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
class StemmerDictionaryParserTest {
|
class StemmerDictionaryParserTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,6 +99,10 @@ class StemmerDictionaryParserTest {
|
|||||||
/**
|
/**
|
||||||
* Log handler capturing parser diagnostics for assertions.
|
* Log handler capturing parser diagnostics for assertions.
|
||||||
*/
|
*/
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("parser")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
private static final class CapturedLogHandler extends Handler {
|
private static final class CapturedLogHandler extends Handler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,6 +163,10 @@ class StemmerDictionaryParserTest {
|
|||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("parse(Reader, String, EntryHandler)")
|
@DisplayName("parse(Reader, String, EntryHandler)")
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("parser")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
class ReaderParsingTests {
|
class ReaderParsingTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -334,6 +343,10 @@ class StemmerDictionaryParserTest {
|
|||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("parse(Path, EntryHandler) and parse(String, EntryHandler)")
|
@DisplayName("parse(Path, EntryHandler) and parse(String, EntryHandler)")
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("parser")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
class FileParsingTests {
|
class FileParsingTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -424,6 +437,10 @@ class StemmerDictionaryParserTest {
|
|||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("ParseStatistics")
|
@DisplayName("ParseStatistics")
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("parser")
|
||||||
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
class ParseStatisticsTests {
|
class ParseStatisticsTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import org.junit.jupiter.api.io.TempDir;
|
|||||||
@Tag("integration")
|
@Tag("integration")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
final class StemmerKnowledgeExperimentTest {
|
final class StemmerKnowledgeExperimentTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ class StemmerPatchTrieBinaryIOTest {
|
|||||||
*/
|
*/
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("write(...)")
|
@DisplayName("write(...)")
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("io")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("persistence")
|
||||||
class WriteTests {
|
class WriteTests {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -290,6 +294,10 @@ class StemmerPatchTrieBinaryIOTest {
|
|||||||
*/
|
*/
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("read(...)")
|
@DisplayName("read(...)")
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("io")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("persistence")
|
||||||
class ReadTests {
|
class ReadTests {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -633,6 +641,10 @@ class StemmerPatchTrieBinaryIOTest {
|
|||||||
/**
|
/**
|
||||||
* Output stream that records whether it has been closed.
|
* Output stream that records whether it has been closed.
|
||||||
*/
|
*/
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("io")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("persistence")
|
||||||
private static final class TrackingOutputStream extends ByteArrayOutputStream {
|
private static final class TrackingOutputStream extends ByteArrayOutputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -659,6 +671,10 @@ class StemmerPatchTrieBinaryIOTest {
|
|||||||
/**
|
/**
|
||||||
* Input stream that records whether it has been closed.
|
* Input stream that records whether it has been closed.
|
||||||
*/
|
*/
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("io")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("persistence")
|
||||||
private static final class TrackingInputStream extends ByteArrayInputStream {
|
private static final class TrackingInputStream extends ByteArrayInputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ import org.junit.jupiter.params.provider.MethodSource;
|
|||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
@Tag("io")
|
@Tag("io")
|
||||||
@Tag("parser")
|
@Tag("parser")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("persistence")
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
final class StemmerPatchTrieLoaderTest {
|
final class StemmerPatchTrieLoaderTest {
|
||||||
|
|
||||||
@@ -266,6 +268,9 @@ final class StemmerPatchTrieLoaderTest {
|
|||||||
*/
|
*/
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("API contracts")
|
@DisplayName("API contracts")
|
||||||
|
@Tag("validation")
|
||||||
|
@Tag("integration")
|
||||||
|
@Tag("trie")
|
||||||
final class ApiContractTests {
|
final class ApiContractTests {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -314,11 +319,83 @@ final class StemmerPatchTrieLoaderTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focused internal loader behavior tests.
|
||||||
|
*/
|
||||||
|
@Nested
|
||||||
|
@DisplayName("Internal helper behavior")
|
||||||
|
@Tag("construction")
|
||||||
|
@Tag("integration")
|
||||||
|
@Tag("trie")
|
||||||
|
final class InternalLoaderBehaviorTests {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that bundled language loading follows explicit
|
||||||
|
* right-to-left metadata mapping.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@DisplayName("bundled language loading must infer traversal direction from language metadata")
|
||||||
|
void shouldLoadBundledLanguagesUsingLanguageRightToLeftMetadata() throws IOException {
|
||||||
|
final ReductionSettings settings = ReductionSettings.withDefaults(DEFAULT_REDUCTION_MODE);
|
||||||
|
final FrequencyTrie<String> leftToRightDictionary = StemmerPatchTrieLoader.load(
|
||||||
|
StemmerPatchTrieLoader.Language.US_UK, true, settings);
|
||||||
|
final FrequencyTrie<String> rightToLeftDictionary = StemmerPatchTrieLoader.load(
|
||||||
|
StemmerPatchTrieLoader.Language.FA_IR, true, settings);
|
||||||
|
|
||||||
|
assertEquals(WordTraversalDirection.BACKWARD, leftToRightDictionary.traversalDirection(),
|
||||||
|
"Left-to-right languages should use backward traversal.");
|
||||||
|
assertEquals(WordTraversalDirection.FORWARD, rightToLeftDictionary.traversalDirection(),
|
||||||
|
"Right-to-left languages should use forward traversal.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies the mode-based and settings-based bundled load overloads remain
|
||||||
|
* semantically consistent for traversal direction.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@DisplayName("load(Language,.., ReductionMode) and load(Language,.., ReductionSettings) should agree on traversal direction")
|
||||||
|
void shouldKeepBundledTraversalDirectionConsistentAcrossOverloads() throws IOException {
|
||||||
|
final FrequencyTrie<String> byMode = StemmerPatchTrieLoader.load(
|
||||||
|
StemmerPatchTrieLoader.Language.US_UK, true, DEFAULT_REDUCTION_MODE);
|
||||||
|
final FrequencyTrie<String> bySettings = StemmerPatchTrieLoader.load(
|
||||||
|
StemmerPatchTrieLoader.Language.US_UK, true,
|
||||||
|
ReductionSettings.withDefaults(DEFAULT_REDUCTION_MODE));
|
||||||
|
|
||||||
|
assertEquals(byMode.traversalDirection(), bySettings.traversalDirection());
|
||||||
|
assertEquals(byMode.metadata().reductionSettings().reductionMode(),
|
||||||
|
bySettings.metadata().reductionSettings().reductionMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies bundled resource access succeeds for known resources and fails
|
||||||
|
* for unknown resources.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@DisplayName("openBundledResource should return readable streams for known resources and fail for unknown ones")
|
||||||
|
void shouldOpenBundledResourcesSuccessfullyAndRejectUnknowns() throws IOException {
|
||||||
|
final String resourcePath = StemmerPatchTrieLoader.Language.US_UK.resourcePath();
|
||||||
|
try (InputStream inputStream = StemmerPatchTrieLoader.openBundledResource(resourcePath);
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
|
||||||
|
assertNotNull(reader.readLine(), "Known bundled resource must expose readable content.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final String missingResource = "org/egothor/stemmer/missing-dictionary.dict.gz";
|
||||||
|
final IOException exception = assertThrows(IOException.class,
|
||||||
|
() -> StemmerPatchTrieLoader.openBundledResource(missingResource));
|
||||||
|
|
||||||
|
assertEquals("Stemmer resource not found: " + missingResource, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focused filesystem and parser behavior tests.
|
* Focused filesystem and parser behavior tests.
|
||||||
*/
|
*/
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("Filesystem and parser behavior")
|
@DisplayName("Filesystem and parser behavior")
|
||||||
|
@Tag("io")
|
||||||
|
@Tag("construction")
|
||||||
|
@Tag("integration")
|
||||||
|
@Tag("trie")
|
||||||
final class FilesystemAndParserTests {
|
final class FilesystemAndParserTests {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -578,6 +655,9 @@ final class StemmerPatchTrieLoaderTest {
|
|||||||
@Nested
|
@Nested
|
||||||
@Tag("slow")
|
@Tag("slow")
|
||||||
@DisplayName("Bundled dictionaries")
|
@DisplayName("Bundled dictionaries")
|
||||||
|
@Tag("compat")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("regression")
|
||||||
final class BundledDictionaryTests {
|
final class BundledDictionaryTests {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("metadata")
|
@Tag("metadata")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("validation")
|
||||||
@DisplayName("TrieMetadata")
|
@DisplayName("TrieMetadata")
|
||||||
class TrieMetadataTest {
|
class TrieMetadataTest {
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("core")
|
@Tag("core")
|
||||||
@Tag("stemmer")
|
@Tag("stemmer")
|
||||||
|
@Tag("validation")
|
||||||
@DisplayName("WordTraversalDirection")
|
@DisplayName("WordTraversalDirection")
|
||||||
class WordTraversalDirectionTest {
|
class WordTraversalDirectionTest {
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("ChildDescriptor")
|
@DisplayName("ChildDescriptor")
|
||||||
class ChildDescriptorTest {
|
class ChildDescriptorTest {
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("DominantLocalDescriptor")
|
@DisplayName("DominantLocalDescriptor")
|
||||||
class DominantLocalDescriptorTest {
|
class DominantLocalDescriptorTest {
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("LocalValueSummary")
|
@DisplayName("LocalValueSummary")
|
||||||
class LocalValueSummaryTest {
|
class LocalValueSummaryTest {
|
||||||
|
|
||||||
@@ -190,6 +191,9 @@ class LocalValueSummaryTest {
|
|||||||
/**
|
/**
|
||||||
* Test helper with identical textual form but distinct identity.
|
* Test helper with identical textual form but distinct identity.
|
||||||
*/
|
*/
|
||||||
|
@Tag("unit")
|
||||||
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
private static final class TextTwin {
|
private static final class TextTwin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("construction")
|
||||||
@DisplayName("MutableNode")
|
@DisplayName("MutableNode")
|
||||||
class MutableNodeTest {
|
class MutableNodeTest {
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("RankedLocalDescriptor")
|
@DisplayName("RankedLocalDescriptor")
|
||||||
class RankedLocalDescriptorTest {
|
class RankedLocalDescriptorTest {
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("ReducedNode")
|
@DisplayName("ReducedNode")
|
||||||
class ReducedNodeTest {
|
class ReducedNodeTest {
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("ReductionContext")
|
@DisplayName("ReductionContext")
|
||||||
class ReductionContextTest {
|
class ReductionContextTest {
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("ReductionSignature")
|
@DisplayName("ReductionSignature")
|
||||||
class ReductionSignatureTest {
|
class ReductionSignatureTest {
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
@Tag("unit")
|
@Tag("unit")
|
||||||
@Tag("trie")
|
@Tag("trie")
|
||||||
|
@Tag("reduction")
|
||||||
@DisplayName("UnorderedLocalDescriptor")
|
@DisplayName("UnorderedLocalDescriptor")
|
||||||
class UnorderedLocalDescriptorTest {
|
class UnorderedLocalDescriptorTest {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user