IOOBExceptionShouldNotBeThrownWhenNotCodingFluentlyTest.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:astor 作者:
@Test
public void second_stubbing_throws_IndexOutOfBoundsException() throws Exception {
    Map<String, String> map = mock(Map.class);

    OngoingStubbing<String> mapOngoingStubbing = when(map.get(anyString()));

    mapOngoingStubbing.thenReturn("first stubbing");

    try {
        mapOngoingStubbing.thenReturn("second stubbing");
        fail();
    } catch (MockitoException e) {
        assertThat(e.getMessage())
                .contains("Incorrect use of API detected here")
                .contains(this.getClass().getSimpleName());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号