Move RecordInstanceOfTest to java 17 package

Bug: b/363926134
Change-Id: I16d2cd6f0108492d82605e053ccc953e99730404
diff --git a/src/test/examplesJava17/records/RecordInstanceOf.java b/src/test/examplesJava17/records/RecordInstanceOf.java
deleted file mode 100644
index 591192c..0000000
--- a/src/test/examplesJava17/records/RecordInstanceOf.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2020, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package records;
-
-public class RecordInstanceOf {
-
-  record Empty() {}
-
-  record Person(String name, int age) {}
-
-  public static void main(String[] args) {
-    Empty empty = new Empty();
-    Person janeDoe = new Person("Jane Doe", 42);
-    Object o = new Object();
-    System.out.println(janeDoe instanceof java.lang.Record);
-    System.out.println(empty instanceof java.lang.Record);
-    System.out.println(o instanceof java.lang.Record);
-  }
-}
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java b/src/test/examplesJava17/records/RecordInstanceOfTest.java
similarity index 64%
rename from src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java
rename to src/test/examplesJava17/records/RecordInstanceOfTest.java
index 301210b..0fdb15f 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java
+++ b/src/test/examplesJava17/records/RecordInstanceOfTest.java
@@ -2,8 +2,9 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-package com.android.tools.r8.desugar.records;
+package records;
 
+import com.android.tools.r8.JdkClassFileProvider;
 import com.android.tools.r8.R8FullTestBuilder;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
@@ -17,9 +18,6 @@
 @RunWith(Parameterized.class)
 public class RecordInstanceOfTest extends TestBase {
 
-  private static final String RECORD_NAME = "RecordInstanceOf";
-  private static final byte[][] PROGRAM_DATA = RecordTestUtils.getProgramData(RECORD_NAME);
-  private static final String MAIN_TYPE = RecordTestUtils.getMainType(RECORD_NAME);
   private static final String EXPECTED_RESULT = StringUtils.lines("true", "true", "false");
 
   private final TestParameters parameters;
@@ -41,18 +39,18 @@
   public void testJvm() throws Exception {
     parameters.assumeJvmTestParameters();
     testForJvm(parameters)
-        .addProgramClassFileData(PROGRAM_DATA)
-        .run(parameters.getRuntime(), MAIN_TYPE)
+        .addInnerClassesAndStrippedOuter(getClass())
+        .run(parameters.getRuntime(), TestClass.class)
         .assertSuccessWithOutput(EXPECTED_RESULT);
   }
 
   @Test
   public void testD8() throws Exception {
     testForD8(parameters.getBackend())
-        .addProgramClassFileData(PROGRAM_DATA)
+        .addInnerClassesAndStrippedOuter(getClass())
         .setMinApi(parameters)
         .compile()
-        .run(parameters.getRuntime(), MAIN_TYPE)
+        .run(parameters.getRuntime(), TestClass.class)
         .assertSuccessWithOutput(EXPECTED_RESULT);
   }
 
@@ -61,18 +59,34 @@
     parameters.assumeR8TestParameters();
     R8FullTestBuilder builder =
         testForR8(parameters.getBackend())
-            .addProgramClassFileData(PROGRAM_DATA)
+            .addInnerClassesAndStrippedOuter(getClass())
             .setMinApi(parameters)
-            .addKeepMainRule(MAIN_TYPE);
+            .addKeepMainRule(TestClass.class);
     if (parameters.isCfRuntime()) {
       builder
-          .addLibraryFiles(RecordTestUtils.getJdk15LibraryFiles(temp))
+          .addLibraryProvider(JdkClassFileProvider.fromSystemJdk())
           .compile()
           .inspect(RecordTestUtils::assertRecordsAreRecords)
-          .run(parameters.getRuntime(), MAIN_TYPE)
+          .run(parameters.getRuntime(), TestClass.class)
           .assertSuccessWithOutput(EXPECTED_RESULT);
       return;
     }
-    builder.run(parameters.getRuntime(), MAIN_TYPE).assertSuccessWithOutput(EXPECTED_RESULT);
+    builder.run(parameters.getRuntime(), TestClass.class).assertSuccessWithOutput(EXPECTED_RESULT);
+  }
+
+  record Empty() {}
+
+  record Person(String name, int age) {}
+
+  public class TestClass {
+
+    public static void main(String[] args) {
+      Empty empty = new Empty();
+      Person janeDoe = new Person("Jane Doe", 42);
+      Object o = new Object();
+      System.out.println(janeDoe instanceof java.lang.Record);
+      System.out.println(empty instanceof java.lang.Record);
+      System.out.println(o instanceof java.lang.Record);
+    }
   }
 }