org.assertj.android.api.content.ContentValuesAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assertj-android Show documentation
Show all versions of assertj-android Show documentation
A set of AssertJ assertion helpers geared toward testing Android.
package org.assertj.android.api.content;
import android.content.ContentValues;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.WritableAssertionInfo;
import org.assertj.core.internal.Failures;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.error.ShouldContain.shouldContain;
import static org.assertj.core.util.Objects.areEqual;
/** Assertions for {@link ContentValues} instances. */
public class ContentValuesAssert extends AbstractAssert {
public ContentValuesAssert(ContentValues actual) {
super(actual, ContentValuesAssert.class);
}
public ContentValuesAssert isEmpty() {
isNotNull();
assertThat(actual.size())
.overridingErrorMessage("Expected to be empty but was not.")
.isZero();
return this;
}
public ContentValuesAssert isNotEmpty() {
isNotNull();
assertThat(actual.size())
.overridingErrorMessage("Expected to not be empty but was.")
.isNotZero();
return this;
}
public ContentValuesAssert containsKey(String key) {
isNotNull();
assertThat(actual.containsKey(key))
.overridingErrorMessage("Expected key <%s> but was not found.", key)
.isTrue();
return this;
}
public ContentValuesAssert containsValue(Object expectedValue) {
isNotNull();
Set> entries = actual.valueSet();
List