Migrate the `JavaImportConfiguredTargetTest.testDisallowsFilesInExports` test to Starlark

The test is removed from Bazel and added to rules_java

(ignore-relnotes)

PiperOrigin-RevId: 756261082
Change-Id: Idbf3b8ec2aadc9548b74627029d32cd2b2563416
diff --git a/test/java/common/rules/java_import_tests.bzl b/test/java/common/rules/java_import_tests.bzl
index 92dce45..064c59a 100644
--- a/test/java/common/rules/java_import_tests.bzl
+++ b/test/java/common/rules/java_import_tests.bzl
@@ -472,6 +472,27 @@
         matching.str_matches("empty java_import.jars is no longer supported"),
     )
 
+def _test_disallows_files_in_exports(name):
+    util.helper_target(
+        java_import,
+        name = name + "/rule",
+        jars = ["good.jar"],
+        # we can't create scratch files, so just use one that we know has a label
+        exports = ["BUILD"],
+    )
+
+    analysis_test(
+        name = name,
+        impl = _test_disallows_files_in_exports_impl,
+        target = name + "/rule",
+        expect_failure = True,
+    )
+
+def _test_disallows_files_in_exports_impl(env, target):
+    env.expect.that_target(target).failures().contains_predicate(
+        matching.str_matches("source file * is misplaced here (expected no files)"),
+    )
+
 def java_import_tests(name):
     test_suite(
         name = name,
@@ -490,5 +511,6 @@
             _test_jars_allowed_in_srcjar,
             _test_permits_empty_jars_with_flag,
             _test_disallows_empty_jars,
+            _test_disallows_files_in_exports,
         ],
     )