// Path: src/main/java/com/google/devtools/build/bfg/ClassGraphPreprocessor.java
// static ImmutableGraph<String> preProcessClassGraph(
//     ImmutableGraph<String> classGraph, Pattern whiteList, Pattern blackList) {
//   return collapseInnerClasses(trimClassGraph(classGraph, whiteList, blackList));
// }


import static com.google.common.truth.Truth.assertThat;
import static com.google.devtools.build.bfg.ClassGraphPreprocessor.preProcessClassGraph;
import com.google.common.graph.EndpointPair;
import com.google.common.graph.Graph;
import com.google.common.graph.GraphBuilder;
import com.google.common.graph.ImmutableGraph;
import com.google.common.graph.MutableGraph;
import com.google.re2j.Pattern;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

    MutableGraph<String> expected = newGraph();
    expected.putEdge("com.WhiteList", "com.OtherList");

    assertEquivalent(actual, expected);
    assertThat(actual.nodes()).doesNotContain("com.TransitiveDependency");
  }

  /**
   * Tests whether black listed classes names as well as their non-whitelisted dependencies are
   * removed from the class graph. In addition to not containing the black listed class, the
   * resulting graph should also not contain nonwhite listed classes only black listed classes are
   * dependent on. For example, say we were to have the following class graph
   *
   * <p>com.Whitelist --> com.Blacklist --> com.NonWhitelist
   *
   * <p>Then the resulting class graph should only contain com.Whitelist
   */
  @Test
  public void trimRemovesTransitiveDepsOfBlackListedClasses() {
    MutableGraph<String> graph = newGraph();
    graph.putEdge("com.BlackList", "com.OtherList");
    graph.putEdge("com.WhiteList", "com.BlackList");

    Pattern blackList = Pattern.compile("BlackList");
    Pattern whiteList = Pattern.compile("WhiteList");

    Graph<String> actual = preProcessClassGraph(ImmutableGraph.copyOf(graph), whiteList, blackList);

    MutableGraph<String> expected = newGraph();
// Path: src/main/java/com/google/devtools/build/bfg/ClassGraphPreprocessor.java
// static ImmutableGraph<String> preProcessClassGraph(
//     ImmutableGraph<String> classGraph, Pattern whiteList, Pattern blackList) {
//   return collapseInnerClasses(trimClassGraph(classGraph, whiteList, blackList));
// }


// Path: src/test/java/com/google/devtools/build/bfg/ClassGraphPreprocessorTest.java
import static com.google.common.truth.Truth.assertThat;
import static com.google.devtools.build.bfg.ClassGraphPreprocessor.preProcessClassGraph;
import com.google.common.graph.EndpointPair;
import com.google.common.graph.Graph;
import com.google.common.graph.GraphBuilder;
import com.google.common.graph.ImmutableGraph;
import com.google.common.graph.MutableGraph;
import com.google.re2j.Pattern;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;


    MutableGraph<String> expected = newGraph();
    expected.putEdge("com.WhiteList", "com.OtherList");

    assertEquivalent(actual, expected);
    assertThat(actual.nodes()).doesNotContain("com.TransitiveDependency");
  }

  /**
   * Tests whether black listed classes names as well as their non-whitelisted dependencies are
   * removed from the class graph. In addition to not containing the black listed class, the
   * resulting graph should also not contain nonwhite listed classes only black listed classes are
   * dependent on. For example, say we were to have the following class graph
   *
   * <p>com.Whitelist --> com.Blacklist --> com.NonWhitelist
   *
   * <p>Then the resulting class graph should only contain com.Whitelist
   */
  @Test
  public void trimRemovesTransitiveDepsOfBlackListedClasses() {
    MutableGraph<String> graph = newGraph();
    graph.putEdge("com.BlackList", "com.OtherList");
    graph.putEdge("com.WhiteList", "com.BlackList");

    Pattern blackList = Pattern.compile("BlackList");
    Pattern whiteList = Pattern.compile("WhiteList");

    Graph<String> actual = preProcessClassGraph(ImmutableGraph.copyOf(graph), whiteList, blackList);

    MutableGraph<String> expected = newGraph();
    expected.addNode("com.WhiteList");