Skip to content

Commit

Permalink
[BEAM-10085] Fix DirectRunnerApiSurfaceTest for Java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
kennknowles committed Jul 10, 2020
1 parent baf0d26 commit bd9cdb1
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*/
package org.apache.beam.runners.direct;

import static org.apache.beam.sdk.util.ApiSurface.containsOnlyPackages;
import static org.apache.beam.sdk.util.ApiSurface.classesInPackage;
import static org.apache.beam.sdk.util.ApiSurface.containsOnlyClassesMatching;
import static org.apache.beam.sdk.util.ApiSurface.optionalClassWithName;
import static org.junit.Assert.assertThat;

import java.util.Set;
Expand All @@ -29,6 +31,7 @@
import org.apache.beam.sdk.transforms.display.DisplayData;
import org.apache.beam.sdk.util.ApiSurface;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableSet;
import org.hamcrest.Matcher;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -40,13 +43,14 @@ public class DirectRunnerApiSurfaceTest {
public void testDirectRunnerApiSurface() throws Exception {
// The DirectRunner can expose the Core SDK, anything exposed by the Core SDK, and itself
@SuppressWarnings("unchecked")
final Set<String> allowed =
final Set<Matcher<Class<?>>> allowed =
ImmutableSet.of(
"org.apache.beam.sdk",
"org.apache.beam.runners.direct",
"org.joda.time",
"javax.annotation",
"java.math");
optionalClassWithName("jdk.internal.HotSpotIntrinsicCandidate"),
classesInPackage("org.apache.beam.sdk"),
classesInPackage("org.apache.beam.runners.direct"),
classesInPackage("org.joda.time"),
classesInPackage("javax.annotation"),
classesInPackage("java.math"));

final Package thisPackage = getClass().getPackage();
final ClassLoader thisClassLoader = getClass().getClassLoader();
Expand All @@ -73,6 +77,6 @@ public void testDirectRunnerApiSurface() throws Exception {
.pruningPattern("java[.]lang.*")
.pruningPattern("java[.]util.*");

assertThat(apiSurface, containsOnlyPackages(allowed));
assertThat(apiSurface, containsOnlyClassesMatching(allowed));
}
}

0 comments on commit bd9cdb1

Please sign in to comment.