// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
//   return new GraphBuilder<R>(func);
// }


import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;

    Graph<String> g1 = call(node1).with(input).bind(input, "erich");
    Graph<String> g2 = call(node1).with(g1);

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage(DUPLICATE_BINDING_FOR_INPUT);
    thrown.expectMessage("mein Name");

    g2.bind(input, "volker").run();
  }

  @Test
  public void shouldThrowForDuplicateBindOfNameInDiamondSubgraphs() throws Exception {
    Func1<String, String> node1 = new Func1<String, String>() {
      @Override
      public ListenableFuture<String> run(String arg) {
        return immediateFuture(arg + ", 1");
      }
    };
   Func2<String, String, String> node2 = new Func2<String, String, String>() {
      @Override
      public ListenableFuture<String> run(String arg, String arg2) {
        return immediateFuture(arg + ", " + arg2);
      }
    };

    Input<String> input = Input.named("mitt namn");
    Input<String> input2 = Input.named("nåt");

    Graph<String> g1 = call(node1).with(input).bind(input, "erik").bind(input2, "hej");
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
//   return new GraphBuilder<R>(func);
// }


// Path: src/test/java/com/spotify/trickle/TrickleApiTest.java
import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;


    Graph<String> g1 = call(node1).with(input).bind(input, "erich");
    Graph<String> g2 = call(node1).with(g1);

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage(DUPLICATE_BINDING_FOR_INPUT);
    thrown.expectMessage("mein Name");

    g2.bind(input, "volker").run();
  }

  @Test
  public void shouldThrowForDuplicateBindOfNameInDiamondSubgraphs() throws Exception {
    Func1<String, String> node1 = new Func1<String, String>() {
      @Override
      public ListenableFuture<String> run(String arg) {
        return immediateFuture(arg + ", 1");
      }
    };
   Func2<String, String, String> node2 = new Func2<String, String, String>() {
      @Override
      public ListenableFuture<String> run(String arg, String arg2) {
        return immediateFuture(arg + ", " + arg2);
      }
    };

    Input<String> input = Input.named("mitt namn");
    Input<String> input2 = Input.named("nåt");

    Graph<String> g1 = call(node1).with(input).bind(input, "erik").bind(input2, "hej");
    Graph<String> g2 = call(node1).with(input).bind(input, "folke").bind(input2, "hopp");