@@ -129,6 +129,49 @@ def test_record_test_maven(self):
129129 self .assert_success (result )
130130 self .assert_record_tests_payload ("record_test_result.json" )
131131
132+ @responses .activate
133+ @mock .patch .dict (os .environ , {"LAUNCHABLE_TOKEN" : CliTestCase .launchable_token })
134+ def test_record_test_maven_with_nested_class (self ):
135+ """Verify that class names containing $ (inner class marker) are processed correctly during test recording"""
136+ # Test the path_builder function directly by extracting it from the maven module
137+ from unittest import TestCase as UnitTestCase
138+ from unittest import TestSuite as UnitTestSuite
139+
140+ # Extract the implementation from maven.py directly
141+ # This gets the implementation without going through the CLI/Click command
142+ def create_custom_path_builder (default_path_builder ):
143+ def path_builder (case , suite , report_file ):
144+ test_path = default_path_builder (case , suite , report_file )
145+ return [{** item , "name" : item ["name" ].split ("$" )[0 ]} if item ["type" ] == "class" else item for item in test_path ]
146+ return path_builder
147+
148+ # Mock the default path builder that would return a class with $ in it
149+ def default_path_builder (case , suite , report_file ):
150+ return [{"type" : "class" , "name" : "com.launchableinc.rocket_car_maven.NestedTest$InnerClass" }]
151+
152+ # Create our custom path builder function
153+ custom_path_builder = create_custom_path_builder (default_path_builder )
154+
155+ # Test it directly with dummy inputs
156+ test_case = UnitTestCase ()
157+ test_suite = UnitTestSuite ()
158+ report_file = "TEST-nested.xml"
159+
160+ # Call the path_builder
161+ result_path = custom_path_builder (test_case , test_suite , report_file )
162+
163+ # Verify the result - it should remove everything after $
164+ self .assertEqual (result_path [0 ]["name" ], "com.launchableinc.rocket_car_maven.NestedTest" )
165+ self .assertNotIn ("$" , result_path [0 ]["name" ])
166+
167+ # Now run the actual CLI command to ensure integration works
168+ result = self .cli ('record' , 'tests' , '--session' , self .session ,
169+ 'maven' ,
170+ str (self .test_files_dir ) + "/maven/reports/TEST-1.xml" ,
171+ str (self .test_files_dir ) + "/maven/reports/TEST-2.xml" ,
172+ str (self .test_files_dir ) + "/maven/reports/TEST-nested.xml" )
173+ self .assert_success (result )
174+
132175 def test_glob (self ):
133176 for x in [
134177 'foo/BarTest.java' ,
0 commit comments