Node implements InputNode<IN>, OutputNode<OUT> { protected void emitOutput(final OUT output) { if (!errorReceived && output != null) { for (final InputNode<OUT> inputNode : inputNodes) { inputNode.onInput(this, output); } } } protected  Node(); static OutputActionNode<OUT> begin(final OutputAction<OUT> action); static RequestNode<OUT, OUT> begin(final RequestDelegate<OUT> delegate); static TimerNode<OUT> beginTimer(final OUT input, final long delay); static TimerNode<OUT> beginTimer(final OUT input, final long delay, final long interval, final int repeatCount); static ViewNode whenClicked(final View view); static TextViewNode whenTextChanged(final TextView textView); boolean isErrorReceived(); Graph<?> getGraph(); @Override void setGraph(final Graph<?> graph); @Override InputNode<OUT> attach(final InputNode<OUT> inputNode); @Override void detach(final InputNode<OUT> inputNode); boolean hasInputNodes(); @Override void emitOutput(); @CallSuper @Override void onReset(); @CallSuper @Override void onInput(final OutputNode<IN> source, final IN input); @Override void onCompleted(final OutputNode<?> source); @CallSuper @Override void onError(final OutputNode<?> source, final Throwable throwable); void start(); Node<OUT, T> action(final Action action); Node<OUT, T> action(final Action1<OUT> action); Node<OUT, OUT> buffer(final int capacity); @SafeVarargs final Node<OUT, OUT> concat(final OutputNode<OUT>... sources); Node<OUT, String> concatStrings(); Node<OUT, Integer> count(); Node<OUT, OUT> distinct(); Node<OUT, OUT> filter(final BooleanFunction<OUT> condition); Node<OUT, OUT> first(final BooleanFunction<OUT> condition); Node<OUT, OUT> first(); Node<OUT, T> map(final Function<OUT, T> function); Node<OUT, OUT> last(final BooleanFunction<OUT> condition); Node<OUT, OUT> last(); @SafeVarargs final Node<OUT, OUT> merge(final OutputNode<OUT>... sources); Node<OUT, OUT> nth(final int steps); Node<OUT, OUT> observer(final NodeObserver<OUT> observer); Node<OUT, OUT> repeat(final int times); Node<OUT, T> observer(final RequestDelegate<T> delegate); Node<OUT, OUT> reverse(); Node<OUT, OUT> skip(final int steps); Node<OUT, OUT> skipWhile(final BooleanFunction<OUT> condition); Node<OUT, String> string(); Node<OUT, Double> sum(); Node<OUT, OUT> take(final int steps); Node<OUT, OUT> timer(final long delay); Node<OUT, OUT> timer(final long delay, final long interval, final int repeatCount); Node<OUT, Boolean> toBoolean(); Node<OUT, Byte> toByte(); Node<OUT, Character> toChar(); Node<OUT, Double> toDouble(); Node<OUT, Float> toFloat(); Node<OUT, Integer> toInt(); Node<OUT, Long> toLong(); Node<OUT, Short> toShort(); Node<OUT, OUT> toMain(); Node<OUT, OUT> toWorker();  }
@Test public void test_logic() { AuthenticatorImpl authenticator; Node<Response, Response> loginNode; Response response; response = new Response(); response.error = Error.A.getErrorMsg(); response.statusCode = 400; authenticator = new AuthenticatorImpl(response); loginNode = createGraph(authenticator); loginNode.emitOutput(); assertTrue(authenticator.failed()); response = new Response(); response.error = Error.D.getErrorMsg(); response.statusCode = 401; authenticator = new AuthenticatorImpl(response); loginNode = createGraph(authenticator); loginNode.emitOutput(); assertTrue(authenticator.failed()); response = new Response(); response.statusCode = 200; authenticator = new AuthenticatorImpl(response); loginNode = createGraph(authenticator); loginNode.emitOutput(); assertTrue(authenticator.succeeded()); }