/** Test consuming tokens after join. */
  @Test
  public void testConsumingTokensAfterJoin() {
    instance.createToken(node3);
    token.setCurrentNode(node2);
    node2.getIncomingBehaviour().join(token);

    assertTrue(
        instance.getAssignedTokens().size() == 1, "There should be now just one token left.");
    assertTrue(
        util.getTokensWhichAreOnNode(node3, instance).size() == 0,
        "Start nodes should be token free.");
    assertTrue(
        util.getTokensWhichAreOnNode(node, instance).size() == 0,
        "Start nodes should be token free.");
  }
  /** Set up. An instance is build. */
  @BeforeMethod
  public void setUp() {

    // Place
    node = new NodeImpl(new NullActivity(), null, new PlaceSplitBehaviour());
    node.setAttribute("name", "1");

    // Transition, we start right here (just for testing purposes)
    node2 =
        new NodeImpl(
            new NullActivity(), new TransitionJoinBehaviour(), new TransitionSplitBehaviour());
    node2.setAttribute("name", "2");

    // Place
    node3 = new NodeImpl(new NullActivity(), null, new PlaceSplitBehaviour());
    node3.setAttribute("name", "3");

    // Place
    node4 = new NodeImpl(new NullActivity(), null, new PlaceSplitBehaviour());
    node4.setAttribute("name", "4");

    node.controlFlowTo(node2);
    node3.controlFlowTo(node2);
    node2.controlFlowTo(node4);

    util = new TokenUtil();
    TokenBuilder tokenBuilder = new PetriNetTokenBuilder(Mockito.mock(Navigator.class), null);
    instance = new ProcessInstance(null, tokenBuilder);
    token = instance.createToken(node);
  }
 /** Test true join ability. */
 @Test
 public void testTrueJoinAbility() {
   instance.createToken(node3);
   assertTrue(
       node2.getIncomingBehaviour().joinable(token, node2),
       "It should return true," + " because the missing token is there.");
 }
  /** Tests the join. */
  @Test
  public void testJoin() {
    instance.createToken(node3);
    token.setCurrentNode(node2);

    Collection<Token> newTokens = null;
    newTokens = node2.getIncomingBehaviour().join(token);

    assertTrue(newTokens.size() == 1, "One token was moved, so the size should be 1.");
  }