@@ -405,23 +405,11 @@ public void testComplexDependencySyntaxWithIgnorePatterns(@TempDir Path tempDir)
405405 """ ;
406406 Files .writeString (cargoToml , content );
407407
408- // Create RustProvider and test ignore detection
409408 CargoProvider provider = new CargoProvider (cargoToml );
410-
411- // Read the file content for the updated method signature
412409 String cargoContent = Files .readString (cargoToml , StandardCharsets .UTF_8 );
410+ TomlParseResult tomlResult = Toml .parse (cargoToml );
413411
414- // Parse TOML using TOMLJ (matching the optimized implementation)
415- org .tomlj .TomlParseResult tomlResult = org .tomlj .Toml .parse (cargoToml );
416-
417- // Use reflection to test the private getIgnoredDependencies method with new signature
418- java .lang .reflect .Method method =
419- CargoProvider .class .getDeclaredMethod (
420- "getIgnoredDependencies" , org .tomlj .TomlParseResult .class , String .class );
421- method .setAccessible (true );
422-
423- @ SuppressWarnings ("unchecked" )
424- Set <String > ignoredDeps = (Set <String >) method .invoke (provider , tomlResult , cargoContent );
412+ Set <String > ignoredDeps = provider .getIgnoredDependencies (tomlResult , cargoContent );
425413
426414 System .out .println ("Complex syntax test - Ignored dependencies found:" );
427415 for (String dep : ignoredDeps ) {
@@ -627,20 +615,10 @@ public void testEdgeCaseCargoTomlFormats(@TempDir Path tempDir) throws Exception
627615 assertTrue (sbomContent .contains ("edge-case-project" ), "Should contain project name" );
628616
629617 // Test ignore detection with edge case formatting
630- // Read the file content for the updated method signature
631618 String edgeCargoContent = Files .readString (edgeCaseCargoToml , StandardCharsets .UTF_8 );
619+ TomlParseResult edgeTomlResult = Toml .parse (edgeCaseCargoToml );
632620
633- // Parse TOML using TOMLJ (matching the optimized implementation)
634- org .tomlj .TomlParseResult edgeTomlResult = org .tomlj .Toml .parse (edgeCaseCargoToml );
635-
636- java .lang .reflect .Method method =
637- CargoProvider .class .getDeclaredMethod (
638- "getIgnoredDependencies" , org .tomlj .TomlParseResult .class , String .class );
639- method .setAccessible (true );
640-
641- @ SuppressWarnings ("unchecked" )
642- Set <String > ignoredDeps =
643- (Set <String >) method .invoke (provider , edgeTomlResult , edgeCargoContent );
621+ Set <String > ignoredDeps = provider .getIgnoredDependencies (edgeTomlResult , edgeCargoContent );
644622
645623 // Should detect ignore patterns despite varying spacing and formatting
646624 assertTrue (ignoredDeps .contains ("dep1" ), "Should ignore dep1 (extra spaces)" );
@@ -788,17 +766,10 @@ public void testMemberCargoTomlIgnorePatternsDetected(@TempDir Path tempDir) thr
788766 Files .writeString (memberCargoToml , memberContent );
789767
790768 CargoProvider provider = new CargoProvider (memberCargoToml );
791-
792- java .lang .reflect .Method method =
793- CargoProvider .class .getDeclaredMethod (
794- "getIgnoredDependencies" , TomlParseResult .class , String .class );
795- method .setAccessible (true );
796-
797769 TomlParseResult tomlResult = Toml .parse (memberCargoToml );
798770 String content = Files .readString (memberCargoToml , StandardCharsets .UTF_8 );
799771
800- @ SuppressWarnings ("unchecked" )
801- Set <String > ignoredDeps = (Set <String >) method .invoke (provider , tomlResult , content );
772+ Set <String > ignoredDeps = provider .getIgnoredDependencies (tomlResult , content );
802773
803774 assertTrue (ignoredDeps .contains ("serde" ), "serde should be ignored (exhortignore)" );
804775 assertFalse (ignoredDeps .contains ("tokio" ), "tokio should NOT be ignored" );
@@ -827,17 +798,10 @@ public void testMemberIgnorePatternsWithTableFormat(@TempDir Path tempDir) throw
827798 Files .writeString (memberCargoToml , memberContent );
828799
829800 CargoProvider provider = new CargoProvider (memberCargoToml );
830-
831- java .lang .reflect .Method method =
832- CargoProvider .class .getDeclaredMethod (
833- "getIgnoredDependencies" , TomlParseResult .class , String .class );
834- method .setAccessible (true );
835-
836801 TomlParseResult tomlResult = Toml .parse (memberCargoToml );
837802 String content = Files .readString (memberCargoToml , StandardCharsets .UTF_8 );
838803
839- @ SuppressWarnings ("unchecked" )
840- Set <String > ignoredDeps = (Set <String >) method .invoke (provider , tomlResult , content );
804+ Set <String > ignoredDeps = provider .getIgnoredDependencies (tomlResult , content );
841805
842806 assertFalse (ignoredDeps .contains ("serde-json-wasm" ), "serde-json-wasm should NOT be ignored" );
843807 assertTrue (
0 commit comments