Example #1
0
  @SuppressWarnings("all")
  @Test
  public void shouldStubCorrectlyWhenDoubleStringAndMixedVarargsUsed() {
    MixedVarargs mixedVarargs = mock(MixedVarargs.class);
    when(mixedVarargs.doSomething("one", "two", null)).thenReturn("hello");
    when(mixedVarargs.doSomething("1", "2", null)).thenReturn("goodbye");

    String result = mixedVarargs.doSomething("one", "two", null);
    assertEquals("hello", result);
  }
Example #2
0
  @SuppressWarnings("all")
  @Test
  // See bug #31
  public void shouldStubCorrectlyWhenMixedVarargsUsed() {
    MixedVarargs mixedVarargs = mock(MixedVarargs.class);
    when(mixedVarargs.doSomething("hello", null)).thenReturn("hello");
    when(mixedVarargs.doSomething("goodbye", null)).thenReturn("goodbye");

    String result = mixedVarargs.doSomething("hello", null);
    assertEquals("hello", result);

    verify(mixedVarargs).doSomething("hello", null);
  }