/** * {@inheritDoc} */ @Override @CheckReturnValue public SELF usingDefaultElementComparator() { this.iterables = Iterables.instance(); return usingDefaultComparator(); }
/** * {@inheritDoc} */ @Override @CheckReturnValue public SELF usingDefaultElementComparator() { this.iterables = Iterables.instance(); return usingDefaultComparator(); }
private <T> boolean conditionIsMetAtIndex(AssertionInfo info, List<T> actual, Condition<? super T> condition, Index index) { assertNotNull(info, actual); assertNotNull(condition); Iterables.instance().assertNotEmpty(info, actual); checkIndexValueIsValid(index, actual.size() - 1); return condition.matches(actual.get(index.value)); }
private <T> boolean conditionIsMetAtIndex(AssertionInfo info, List<T> actual, Condition<? super T> condition, Index index) { assertNotNull(info, actual); assertNotNull(condition); Iterables.instance().assertNotEmpty(info, actual); checkIndexValueIsValid(index, actual.size() - 1); return condition.matches(actual.get(index.value)); }
/** * Verifies that the given {@code List} contains the given object at the given index. * @param info contains information about the assertion. * @param actual the given {@code List}. * @param value the object to look for. * @param index the index where the object should be stored in the given {@code List}. * @throws AssertionError if the given {@code List} is {@code null} or empty. * @throws NullPointerException if the given {@code Index} is {@code null}. * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of the given * {@code List}. * @throws AssertionError if the given {@code List} does not contain the given object at the given index. */ public void assertContains(AssertionInfo info, List<?> actual, Object value, Index index) { assertNotNull(info, actual); Iterables.instance().assertNotEmpty(info, actual); checkIndexValueIsValid(index, actual.size() - 1); Object actualElement = actual.get(index.value); if (areEqual(actualElement, value)) return; throw failures.failure(info, shouldContainAtIndex(actual, value, index, actual.get(index.value), comparisonStrategy)); }
/** * Verifies that the given {@code List} contains the given object at the given index. * @param info contains information about the assertion. * @param actual the given {@code List}. * @param value the object to look for. * @param index the index where the object should be stored in the given {@code List}. * @throws AssertionError if the given {@code List} is {@code null} or empty. * @throws NullPointerException if the given {@code Index} is {@code null}. * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of the given * {@code List}. * @throws AssertionError if the given {@code List} does not contain the given object at the given index. */ public void assertContains(AssertionInfo info, List<?> actual, Object value, Index index) { assertNotNull(info, actual); Iterables.instance().assertNotEmpty(info, actual); checkIndexValueIsValid(index, actual.size() - 1); Object actualElement = actual.get(index.value); if (areEqual(actualElement, value)) return; throw failures.failure(info, shouldContainAtIndex(actual, value, index, actual.get(index.value), comparisonStrategy)); }
/** * {@inheritDoc} */ @Override public S usingDefaultElementComparator() { usingDefaultComparator(); this.iterables = Iterables.instance(); return myself; }
/** * Verifies that the actual Query's queryParameters contains the given QueryParameter elements. * @param queryParameters the given elements that should be contained in actual Query's queryParameters. * @return this assertion object. * @throws AssertionError if the actual Query's queryParameters does not contain all given QueryParameter elements. */ public QueryAssert hasQueryParameters(QueryParameter... queryParameters) { // check that actual Query we want to make assertions on is not null. isNotNull(); // check that given QueryParameter varargs is not null. if (queryParameters == null) throw new AssertionError("Expecting queryParameters parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContains(info, actual.getQueryParameters(), queryParameters); // return the current assertion for method chaining return this; }
private <T> boolean conditionIsMetAtIndex(AssertionInfo info, List<T> actual, Condition<? super T> condition, Index index) { assertNotNull(info, actual); assertNotNull(condition); Iterables.instance().assertNotEmpty(info, actual); checkIndexValueIsValid(index, actual.size() - 1); return condition.matches(actual.get(index.value)); }
/** * Verifies that the actual DeploymentRecordValue's deployedWorkflows contains <b>only</b> the given io.zeebe.exporter.record.value.deployment.DeployedWorkflow elements in Collection and nothing else in whatever order. * @param deployedWorkflows the given elements that should be contained in actual DeploymentRecordValue's deployedWorkflows. * @return this assertion object. * @throws AssertionError if the actual DeploymentRecordValue's deployedWorkflows does not contain all given io.zeebe.exporter.record.value.deployment.DeployedWorkflow elements. */ public S hasOnlyDeployedWorkflows(java.util.Collection<? extends io.zeebe.exporter.record.value.deployment.DeployedWorkflow> deployedWorkflows) { // check that actual DeploymentRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.deployment.DeployedWorkflow collection is not null. if (deployedWorkflows == null) { failWithMessage("Expecting deployedWorkflows parameter not to be null."); return myself; // to fool Eclipse "Null pointer access" warning on toArray. } // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContainsOnly(info, actual.getDeployedWorkflows(), deployedWorkflows.toArray()); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual DeploymentRecordValue's resources contains <b>only</b> the given io.zeebe.exporter.record.value.deployment.DeploymentResource elements in Collection and nothing else in whatever order. * @param resources the given elements that should be contained in actual DeploymentRecordValue's resources. * @return this assertion object. * @throws AssertionError if the actual DeploymentRecordValue's resources does not contain all given io.zeebe.exporter.record.value.deployment.DeploymentResource elements. */ public S hasOnlyResources(java.util.Collection<? extends io.zeebe.exporter.record.value.deployment.DeploymentResource> resources) { // check that actual DeploymentRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.deployment.DeploymentResource collection is not null. if (resources == null) { failWithMessage("Expecting resources parameter not to be null."); return myself; // to fool Eclipse "Null pointer access" warning on toArray. } // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContainsOnly(info, actual.getResources(), resources.toArray()); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual JobBatchRecordValue's jobKeys contains <b>only</b> the given Long elements and nothing else in whatever order. * @param jobKeys the given elements that should be contained in actual JobBatchRecordValue's jobKeys. * @return this assertion object. * @throws AssertionError if the actual JobBatchRecordValue's jobKeys does not contain all given Long elements. */ public S hasOnlyJobKeys(Long... jobKeys) { // check that actual JobBatchRecordValue we want to make assertions on is not null. isNotNull(); // check that given Long varargs is not null. if (jobKeys == null) failWithMessage("Expecting jobKeys parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContainsOnly(info, actual.getJobKeys(), jobKeys); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual DeploymentRecordValue's resources does not contain the given io.zeebe.exporter.record.value.deployment.DeploymentResource elements. * * @param resources the given elements that should not be in actual DeploymentRecordValue's resources. * @return this assertion object. * @throws AssertionError if the actual DeploymentRecordValue's resources contains any given io.zeebe.exporter.record.value.deployment.DeploymentResource elements. */ public S doesNotHaveResources(io.zeebe.exporter.record.value.deployment.DeploymentResource... resources) { // check that actual DeploymentRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.deployment.DeploymentResource varargs is not null. if (resources == null) failWithMessage("Expecting resources parameter not to be null."); // check with standard error message (use overridingErrorMessage before contains to set your own message). Iterables.instance().assertDoesNotContain(info, actual.getResources(), resources); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual JobBatchRecordValue's jobKeys contains the given Long elements. * @param jobKeys the given elements that should be contained in actual JobBatchRecordValue's jobKeys. * @return this assertion object. * @throws AssertionError if the actual JobBatchRecordValue's jobKeys does not contain all given Long elements. */ public S hasJobKeys(Long... jobKeys) { // check that actual JobBatchRecordValue we want to make assertions on is not null. isNotNull(); // check that given Long varargs is not null. if (jobKeys == null) failWithMessage("Expecting jobKeys parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContains(info, actual.getJobKeys(), jobKeys); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual RaftRecordValue's members does not contain the given io.zeebe.exporter.record.value.raft.RaftMember elements. * * @param members the given elements that should not be in actual RaftRecordValue's members. * @return this assertion object. * @throws AssertionError if the actual RaftRecordValue's members contains any given io.zeebe.exporter.record.value.raft.RaftMember elements. */ public S doesNotHaveMembers(io.zeebe.exporter.record.value.raft.RaftMember... members) { // check that actual RaftRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.raft.RaftMember varargs is not null. if (members == null) failWithMessage("Expecting members parameter not to be null."); // check with standard error message (use overridingErrorMessage before contains to set your own message). Iterables.instance().assertDoesNotContain(info, actual.getMembers(), members); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual RaftRecordValue's members contains the given io.zeebe.exporter.record.value.raft.RaftMember elements. * @param members the given elements that should be contained in actual RaftRecordValue's members. * @return this assertion object. * @throws AssertionError if the actual RaftRecordValue's members does not contain all given io.zeebe.exporter.record.value.raft.RaftMember elements. */ public S hasMembers(io.zeebe.exporter.record.value.raft.RaftMember... members) { // check that actual RaftRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.raft.RaftMember varargs is not null. if (members == null) failWithMessage("Expecting members parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContains(info, actual.getMembers(), members); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual RaftRecordValue's members contains <b>only</b> the given io.zeebe.exporter.record.value.raft.RaftMember elements and nothing else in whatever order. * @param members the given elements that should be contained in actual RaftRecordValue's members. * @return this assertion object. * @throws AssertionError if the actual RaftRecordValue's members does not contain all given io.zeebe.exporter.record.value.raft.RaftMember elements. */ public S hasOnlyMembers(io.zeebe.exporter.record.value.raft.RaftMember... members) { // check that actual RaftRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.raft.RaftMember varargs is not null. if (members == null) failWithMessage("Expecting members parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContainsOnly(info, actual.getMembers(), members); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual DeploymentRecordValue's deployedWorkflows contains the given io.zeebe.exporter.record.value.deployment.DeployedWorkflow elements. * @param deployedWorkflows the given elements that should be contained in actual DeploymentRecordValue's deployedWorkflows. * @return this assertion object. * @throws AssertionError if the actual DeploymentRecordValue's deployedWorkflows does not contain all given io.zeebe.exporter.record.value.deployment.DeployedWorkflow elements. */ public S hasDeployedWorkflows(io.zeebe.exporter.record.value.deployment.DeployedWorkflow... deployedWorkflows) { // check that actual DeploymentRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.deployment.DeployedWorkflow varargs is not null. if (deployedWorkflows == null) failWithMessage("Expecting deployedWorkflows parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContains(info, actual.getDeployedWorkflows(), deployedWorkflows); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual DeploymentRecordValue's deployedWorkflows contains <b>only</b> the given io.zeebe.exporter.record.value.deployment.DeployedWorkflow elements and nothing else in whatever order. * @param deployedWorkflows the given elements that should be contained in actual DeploymentRecordValue's deployedWorkflows. * @return this assertion object. * @throws AssertionError if the actual DeploymentRecordValue's deployedWorkflows does not contain all given io.zeebe.exporter.record.value.deployment.DeployedWorkflow elements. */ public S hasOnlyDeployedWorkflows(io.zeebe.exporter.record.value.deployment.DeployedWorkflow... deployedWorkflows) { // check that actual DeploymentRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.deployment.DeployedWorkflow varargs is not null. if (deployedWorkflows == null) failWithMessage("Expecting deployedWorkflows parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContainsOnly(info, actual.getDeployedWorkflows(), deployedWorkflows); // return the current assertion for method chaining return myself; }
/** * Verifies that the actual DeploymentRecordValue's resources contains <b>only</b> the given io.zeebe.exporter.record.value.deployment.DeploymentResource elements and nothing else in whatever order. * @param resources the given elements that should be contained in actual DeploymentRecordValue's resources. * @return this assertion object. * @throws AssertionError if the actual DeploymentRecordValue's resources does not contain all given io.zeebe.exporter.record.value.deployment.DeploymentResource elements. */ public S hasOnlyResources(io.zeebe.exporter.record.value.deployment.DeploymentResource... resources) { // check that actual DeploymentRecordValue we want to make assertions on is not null. isNotNull(); // check that given io.zeebe.exporter.record.value.deployment.DeploymentResource varargs is not null. if (resources == null) failWithMessage("Expecting resources parameter not to be null."); // check with standard error message, to set another message call: info.overridingErrorMessage("my error message"); Iterables.instance().assertContainsOnly(info, actual.getResources(), resources); // return the current assertion for method chaining return myself; }