org.hamcrest.collection.IsArrayWithSize Java Examples

The following examples show how to use org.hamcrest.collection.IsArrayWithSize. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClaimImplTest.java    From JWTDecode.Android with MIT License 5 votes vote down vote up
@Test
public void shouldGetEmptyArrayIfNullValue() {
    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()));
}
 
Example #2
Source File: ClaimImplTest.java    From JWTDecode.Android with MIT License 5 votes vote down vote up
@Test
public void shouldGetEmptyArrayIfNonArrayValue() {
    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()));
}
 
Example #3
Source File: GrammarUtilsTest.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Test
public void emptySubPattern() {
  String[] patternParts = GrammarUtils.splitPattern(PREFIX, "");
  assertThat(patternParts, IsArrayWithSize.emptyArray());
}
 
Example #4
Source File: GrammarUtilsTest.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Test
public void basicSubPatternNotMatchingPrefix() {
  String[] patternParts = GrammarUtils.splitPattern("prefix", "waggle_");
  assertThat(patternParts, IsArrayWithSize.emptyArray());
}
 
Example #5
Source File: WhereTest.java    From alchemy with Apache License 2.0 4 votes vote down vote up
@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());
}
 
Example #6
Source File: WhereTest.java    From alchemy with Apache License 2.0 4 votes vote down vote up
@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());
}
 
Example #7
Source File: WhereTest.java    From alchemy with Apache License 2.0 4 votes vote down vote up
@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());
}
 
Example #8
Source File: WhereTest.java    From alchemy with Apache License 2.0 4 votes vote down vote up
@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());
}