Esempio n. 1
0
  @Test
  public void shouldVerifyBooleanVarargs() {
    mock.withBooleanVarargs(1);
    mock.withBooleanVarargs(2, true, false, true);
    mock.withBooleanVarargs(3, true, true, true);

    verify(mock).withBooleanVarargs(1);
    verify(mock).withBooleanVarargs(2, true, false, true);
    try {
      verify(mock).withBooleanVarargs(3, true, true, true, true);
      fail();
    } catch (ArgumentsAreDifferent e) {
    }
  }
Esempio n. 2
0
  @Test
  public void shouldStubBooleanVarargs() {
    when(mock.withBooleanVarargs(1)).thenReturn(true);
    when(mock.withBooleanVarargs(1, true, false)).thenReturn(true);

    assertEquals(true, mock.withBooleanVarargs(1));
    assertEquals(false, mock.withBooleanVarargs(9999));

    assertEquals(true, mock.withBooleanVarargs(1, true, false));
    assertEquals(false, mock.withBooleanVarargs(1, true, false, true));
    assertEquals(false, mock.withBooleanVarargs(2, true, false));
    assertEquals(false, mock.withBooleanVarargs(1, true));
    assertEquals(false, mock.withBooleanVarargs(1, false, false));
  }