package com.bio4j.angulillos;

import com.bio4j.angulillos.TwitterGraph.*;

import java.util.stream.Stream;
import java.util.Optional;

public abstract class TwitterGraphTestSuite<I extends UntypedGraph<V,VT,E,ET>,V,VT,E,ET> {

  protected TwitterGraph<I,V,VT,E,ET> g;

  public void doSomething(TwitterGraph<I,V,VT,E,ET>.User user) {

    Stream<TwitterGraph<I,V,VT,E,ET>.Tweet> tweets = user.outV(g.Posted());
  }

  public Stream<TwitterGraph<I,V,VT,E,ET>.User> tweetedTheTweetsThatTweeted(TwitterGraph<I,V,VT,E,ET>.User user) {

    return user.outV(g.Posted()).flatMap(
      tw -> tw.inV(g.Posted())
    );
  }

  /*
    This uses arity-specific methods to return **the** user that tweeted a tweet.
  */
  public TwitterGraph<I,V,VT,E,ET>.User tweeted(TwitterGraph<I,V,VT,E,ET>.Tweet tweet) {

    return tweet.inOneV(g.Posted());
  }
}

@@ -833,11 +833,280 @@
 ());%0A  %7D
+%0A%0A  public Stream%3CTwitterGraph%3CI,V,VT,E,ET%3E.User%3E repliedToSomeTweetFrom(TwitterGraph%3CI,V,VT,E,ET%3E.User user) %7B%0A%0A    return user%0A      .outV( g.Posted() )%0A      .flatMap( tw -%3E tw.inV( g.RepliesTo() ) )%0A      .map( tw -%3E tw.inOneV( g.Posted() ) )%0A      .distinct();%0A  %7D
 %0A%7D%0A

add a sample method to the Twitter tests