@Test public void testMapClassInfoToShadowClass() throws IOException { final ClassPath.ClassInfo classInfo = ClassPath.from(Thread.currentThread().getContextClassLoader()) .getTopLevelClasses("com.vrbo.jarviz.util.classloadertest") .stream() .filter(c -> MyTestClass1.class.getName().equals(c.getName())) .findAny() .orElseThrow(IllegalArgumentException::new); final ShadowClass expectedShadowClass = new ShadowClass.Builder() .className(classInfo.getName()) .classBytes(classInfo.asByteSource().read()) .build(); assertThat(mapClassInfoToShadowClass(classInfo)).isEqualTo(expectedShadowClass); }
static ShadowClass mapClassInfoToShadowClass(@Nonnull final ClassPath.ClassInfo classInfo) throws IOException { return new ShadowClass.Builder() .className(classInfo.getName()) .classBytes(classInfo.asByteSource().read()) .build(); }
JarClassLoaderService implements ClassLoaderService { static ShadowClass mapClassInfoToShadowClass(@Nonnull final ClassPath.ClassInfo classInfo) throws IOException { return new ShadowClass.Builder() .className(classInfo.getName()) .classBytes(classInfo.asByteSource().read()) .build(); } }
JarClassLoaderService implements ClassLoaderService { static ShadowClass mapClassInfoToShadowClass(@Nonnull final ClassPath.ClassInfo classInfo) throws IOException { return new ShadowClass.Builder() .className(classInfo.getName()) .classBytes(classInfo.asByteSource().read()) .build(); } @Inject  JarClassLoaderService(final ArtifactDiscoveryService artifactDiscoveryService); }
JarClassLoaderService implements ClassLoaderService { static ShadowClass mapClassInfoToShadowClass(@Nonnull final ClassPath.ClassInfo classInfo) throws IOException { return new ShadowClass.Builder() .className(classInfo.getName()) .classBytes(classInfo.asByteSource().read()) .build(); } @Inject  JarClassLoaderService(final ArtifactDiscoveryService artifactDiscoveryService); @Override List<ShadowClass> getAllClasses(@Nonnull Artifact artifact,
                                           @Nonnull final Predicate<String> classNameFilter); }
JarClassLoaderService implements ClassLoaderService { static ShadowClass mapClassInfoToShadowClass(@Nonnull final ClassPath.ClassInfo classInfo) throws IOException { return new ShadowClass.Builder() .className(classInfo.getName()) .classBytes(classInfo.asByteSource().read()) .build(); } @Inject  JarClassLoaderService(final ArtifactDiscoveryService artifactDiscoveryService); @Override List<ShadowClass> getAllClasses(@Nonnull Artifact artifact,
                                           @Nonnull final Predicate<String> classNameFilter);  }