@Test // Uses of JMockit API: 1
  public void verifyAllInvocationsInOrder() {
    mockedList.add("one");
    mockedList.size();
    mockedList.add("two");

    new FullVerificationsInOrder() {
      {
        mockedList.add("one");
        mockedList.size();
        mockedList.add("two");
      }
    };
  }
  @Test // Uses of JMockit API: 3
  public void verifyInOrder(
      @Mocked final List<String> firstMock, @Mocked final List<String> secondMock) {
    // Using mocks:
    firstMock.add("was called first");
    secondMock.add("was called second");

    new VerificationsInOrder() {
      {
        // Verifies that firstMock was called before secondMock:
        firstMock.add("was called first");
        secondMock.add("was called second");
      }
    };
  }
  @Test(expected = UnexpectedInvocation.class) // Uses of JMockit API: 2
  public void verifyThatInvocationsNeverHappenedWhenTheyDid(@Mocked List<String> mockTwo) {
    mockedList.add("one");
    mockTwo.size();

    new FullVerifications() {
      {
        mockedList.add("one");
      }
    };
  }
  @Test(expected = MissingInvocation.class) // Uses of JMockit API: 1
  public void verifyAllInvocationsInOrderWithOutOfOrderVerifications() {
    mockedList.add("one");
    mockedList.add("two");

    new FullVerificationsInOrder() {
      {
        mockedList.add("two");
        mockedList.add("one");
      }
    };
  }
  @Test(expected = UnexpectedInvocation.class) // Uses of JMockit API: 1
  public void verifyAllInvocationsInOrderWhenMoreOfThemHappen() {
    mockedList.add("one");
    mockedList.add("two");
    mockedList.size();

    new FullVerificationsInOrder() {
      {
        mockedList.add("one");
        mockedList.add("two");
      }
    };
  }
  @Test // Uses of JMockit API: 8
  public void verifyNumberOfInvocations() {
    // Using mock:
    mockedList.add("once");

    mockedList.add("twice");
    mockedList.add("twice");

    mockedList.add("three times");
    mockedList.add("three times");
    mockedList.add("three times");

    new Verifications() {
      {
        // Following two verifications work exactly the same:
        mockedList.add("once"); // minTimes == 1 is the default
        mockedList.add("once");
        times = 1;

        // Verifies exact number of invocations:
        mockedList.add("twice");
        times = 2;
        mockedList.add("three times");
        times = 3;

        // Verifies no invocations occurred:
        mockedList.add("never happened");
        times = 0;

        // Verifies min/max number of invocations:
        mockedList.add("three times");
        minTimes = 1;
        mockedList.add("three times");
        minTimes = 2;
        mockedList.add("three times");
        maxTimes = 5;
      }
    };
  }
  @Test // Uses of JMockit API: 1
  public void verifyAllInvocations() {
    mockedList.add("one");
    mockedList.add("two");

    // Verify all invocations to mockedList.
    new FullVerifications() {
      {
        // Verifies first invocation:
        mockedList.add("one");

        // Verifies second (and last) invocation:
        mockedList.add("two");
      }
    };
  }
  @Test // Uses of JMockit API: 4
  public void verifyThatInvocationsNeverHappened(
      @Mocked List<String> mockTwo, @Mocked List<String> mockThree) {
    // Using mocks - only mockedList is invoked:
    mockedList.add("one");

    // Verify that the two other mocks were never invoked.
    new FullVerifications() {
      {
        // Ordinary verification:
        mockedList.add("one");

        // Verify that method was never called on a mock:
        mockedList.add("two");
        times = 0;
      }
    };
  }