/** generic method. */ @Test public void generics() { add("com.example.Generic"); ClassLoader loader = start(new FoldOperatorProcessor()); Object factory = create(loader, "com.example.GenericFactory"); MockIn<MockHoge> in = MockIn.of(MockHoge.class, "in"); MockOut<MockHoge> out = MockOut.of(MockHoge.class, "out"); Object fold = invoke(factory, "example", in, 100); out.add(output(MockHoge.class, fold, "out")); Graph<String> graph = toGraph(in); assertThat(graph.getConnected("in"), isJust("Generic.example")); assertThat(graph.getConnected("Generic.example"), isJust("out")); }
/** ジェネリックメソッド。 */ @Test public void generics() { add("com.example.Generic"); add("com.example.ExampleEnum"); ClassLoader loader = start(new BranchOperatorProcessor()); Object factory = create(loader, "com.example.GenericFactory"); MockIn<MockHoge> in = MockIn.of(MockHoge.class, "in"); MockOut<MockHoge> high = MockOut.of(MockHoge.class, "high"); MockOut<MockHoge> middle = MockOut.of(MockHoge.class, "middle"); MockOut<MockHoge> low = MockOut.of(MockHoge.class, "low"); Object branch = invoke(factory, "example", in); high.add(output(MockHoge.class, branch, "high")); middle.add(output(MockHoge.class, branch, "middle")); low.add(output(MockHoge.class, branch, "low")); Graph<String> graph = toGraph(in); assertThat(graph.getConnected("in"), isJust("Generic.example")); assertThat(graph.getConnected("Generic.example"), isJust("high", "middle", "low")); }