/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * <p/> * For example: * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre> */ public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> empty() { return org.hamcrest.collection.IsEmptyCollection.<E>empty(); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * <p/> * For example: * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre> * * @param type * the type of the collection's content */ public static <E> org.hamcrest.Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> type) { return org.hamcrest.collection.IsEmptyCollection.<E>emptyCollectionOf(type); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre> * */ public static <E> Matcher<Collection<? extends E>> empty() { return new IsEmptyCollection<E>(); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre> */ public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> empty() { return org.hamcrest.collection.IsEmptyCollection.empty(); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre> * * @param unusedToForceReturnType * the type of the collection's content */ public static <E> org.hamcrest.Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType) { return org.hamcrest.collection.IsEmptyCollection.emptyCollectionOf(unusedToForceReturnType); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * <p/> * For example: * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre> * */ @Factory public static <E> Matcher<Collection<? extends E>> empty() { return new IsEmptyCollection<E>(); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre> * * @param unusedToForceReturnType * the type of the collection's content */ @SuppressWarnings({"unchecked", "UnusedParameters"}) public static <E> Matcher<Collection<E>> emptyCollectionOf(Class<E> unusedToForceReturnType) { return (Matcher)empty(); } }
public void testCompiles() { needs(IsEmptyCollection.emptyCollectionOf(String.class)); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre> * */ public static <E> Matcher<Collection<? extends E>> empty() { return new IsEmptyCollection<E>(); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * <p/> * For example: * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre> * * @param type * the type of the collection's content */ @Factory public static <E> Matcher<Collection<E>> emptyCollectionOf(Class<E> type) { @SuppressWarnings({ "rawtypes", "unchecked" }) final Matcher<Collection<E>> result = (Matcher)empty(); return result; } }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre> * * @param unusedToForceReturnType * the type of the collection's content */ public static <E> org.hamcrest.Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType) { return org.hamcrest.collection.IsEmptyCollection.<E>emptyCollectionOf(unusedToForceReturnType); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre> * */ public static <E> Matcher<Collection<? extends E>> empty() { return new IsEmptyCollection<E>(); }
@Override protected Matcher<Collection<?>> createMatcher() { return empty(); }
/** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code> * method returns <code>true</code>. * For example: * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre> * * @param unusedToForceReturnType * the type of the collection's content */ public static <E> org.hamcrest.Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType) { return org.hamcrest.collection.IsEmptyCollection.emptyCollectionOf(unusedToForceReturnType); }
@Test public void shouldGetEmptyStringArrayWhenParsingEmptyTextNode() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); TextNode textNode = new TextNode(""); tree.put("key", textNode); List<String> values = deserializer.getStringOrArray(tree, "key"); assertThat(values, is(notNullValue())); assertThat(values, is(IsEmptyCollection.empty())); }
@Test public void shouldGetEmptyListIfNonArrayValue() throws Exception { JsonElement value = gson.toJsonTree(1); ClaimImpl claim = new ClaimImpl(value); assertThat(claim.asList(String.class), is(notNullValue())); assertThat(claim.asList(String.class), is(IsEmptyCollection.emptyCollectionOf(String.class))); }
@Test public void shouldGetEmptyListIfNullValue() throws Exception { JsonElement value = gson.toJsonTree(null); ClaimImpl claim = new ClaimImpl(value); assertThat(claim.asList(String.class), is(notNullValue())); assertThat(claim.asList(String.class), is(IsEmptyCollection.emptyCollectionOf(String.class))); }
@Test public void zip_shouldReturnEmptyList_whenNotEnoughInputs() { assertThat(zip(), is(empty())); }
@Test public void shouldStartAllModules() throws Exception { assertThat(mockModuleFactory.startedModules, emptyCollectionOf(Module.class)); deserialize(handle(newPostRequest(getURI(), "{\"action\":\"start\", \"allModules\":\"true\"}"))); for (Module loadedModule : mockModuleFactory.loadedModules) { assertThat(mockModuleFactory.startedModules, hasItem(loadedModule)); } }