java类org.hamcrest.collection.IsArrayWithSize的实例源码

ClaimImplTest.java 文件源码 项目:JWTDecode.Android 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void shouldGetEmptyArrayIfNullValue() throws Exception {
    JsonElement value = gson.toJsonTree(null);
    ClaimImpl claim = new ClaimImpl(value);

    assertThat(claim.asArray(String.class), is(notNullValue()));
    assertThat(claim.asArray(String.class), is(IsArrayWithSize.<String>emptyArray()));
}
ClaimImplTest.java 文件源码 项目:JWTDecode.Android 阅读 26 收藏 0 点赞 0 评论 0
@Test
public void shouldGetEmptyArrayIfNonArrayValue() throws Exception {
    JsonElement value = gson.toJsonTree(1);
    ClaimImpl claim = new ClaimImpl(value);

    assertThat(claim.asArray(String.class), is(notNullValue()));
    assertThat(claim.asArray(String.class), is(IsArrayWithSize.<String>emptyArray()));
}
ArraysTest.java 文件源码 项目:smog 阅读 25 收藏 0 点赞 0 评论 0
@Test
public void canAssignIsArrayWithSizeMatcher() {
    Matcher<Phone[]> withTwoElements = IsArrayWithSize.arrayWithSize(2);
    assertThat(bob, is(aPersonThat().hasPhones(withTwoElements)));

    Matcher<Phone[]> empty = IsArrayWithSize.emptyArray();
    assertThat(bill, is(aPersonThat().hasPhones(empty)));
}
WhereTest.java 文件源码 项目:alchemy 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void isNull() throws Exception {
    mWhere.isNull("test");
    Assert.assertThat(mWhere.toString(), IsEqual.equalTo(" WHERE test IS NULL"));
    Assert.assertThat(mWhere.getValues(), IsArrayWithSize.emptyArray());
}
WhereTest.java 文件源码 项目:alchemy 阅读 40 收藏 0 点赞 0 评论 0
@Test
public void notNull() throws Exception {
    mWhere.notNull("test");
    Assert.assertThat(mWhere.toString(), IsEqual.equalTo(" WHERE test NOT NULL"));
    Assert.assertThat(mWhere.getValues(), IsArrayWithSize.emptyArray());
}
WhereTest.java 文件源码 项目:alchemy 阅读 34 收藏 0 点赞 0 评论 0
@Test
public void sortByAsc() throws Exception {
    mWhere.sortBy("test", SortBy.Order.ASC);
    Assert.assertThat(mWhere.toString(), IsEqual.equalTo(" ORDER BY test ASC"));
    Assert.assertThat(mWhere.getValues(), IsArrayWithSize.emptyArray());
}
WhereTest.java 文件源码 项目:alchemy 阅读 36 收藏 0 点赞 0 评论 0
@Test
public void sortByDesc() throws Exception {
    mWhere.sortBy("test", SortBy.Order.DESC);
    Assert.assertThat(mWhere.toString(), IsEqual.equalTo(" ORDER BY test DESC"));
    Assert.assertThat(mWhere.getValues(), IsArrayWithSize.emptyArray());
}
FacebookAuthProviderTest.java 文件源码 项目:Lock-Facebook.Android 阅读 31 收藏 0 点赞 0 评论 0
@Test
public void shouldNotRequireAndroidPermissions() throws Exception {
    assertThat(provider.getRequiredAndroidPermissions(), is(notNullValue()));
    assertThat(provider.getRequiredAndroidPermissions(), is(IsArrayWithSize.<String>emptyArray()));
}
GoogleAuthProviderTest.java 文件源码 项目:Lock-Google.Android 阅读 27 收藏 0 点赞 0 评论 0
@Test
public void shouldNotRequireAndroidPermissions() throws Exception {
    assertThat(provider.getRequiredAndroidPermissions(), is(notNullValue()));
    assertThat(provider.getRequiredAndroidPermissions(), is(IsArrayWithSize.<String>emptyArray()));
}


问题


面经


文章

微信
公众号

扫码关注公众号