org.assertj.db.api.assertions.AssertOnColumnEquality Maven / Gradle / Ivy
Show all versions of assertj-db Show documentation
/**
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2012-2015 the original author or authors.
*/
package org.assertj.db.api.assertions;
import org.assertj.db.type.DateTimeValue;
import org.assertj.db.type.DateValue;
import org.assertj.db.type.TimeValue;
/**
* Defines the assertion methods on the equality of a column.
*
* @param The "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation"
* for more details.
* @author Régis Pouiller
*/
public interface AssertOnColumnEquality> {
/**
* Verifies that the values of a column are equal to booleans.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* the booleans in parameter :
*
*
*
* assertThat(table).column().hasValues(true, false, true);
*
*
* @param expected The expected boolean values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the booleans in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(Boolean...)
*/
public T hasValues(Boolean... expected);
/**
* Verifies that the values of a column are equal to numbers.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* the numbers in parameter :
*
*
*
* assertThat(table).column().hasValues(5, 10.5, 6);
*
*
* @param expected The expected numbers values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the numbers in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(Number...)
*/
public T hasValues(Number... expected);
/**
* Verifies that the values of a column are equal to bytes.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* arrays of bytes loaded from files in the classpath :
*
*
*
* byte[] bytes1 = bytesContentFromClassPathOf("file1.png");
* byte[] bytes2 = bytesContentFromClassPathOf("file2.png");
* assertThat(table).column().hasValues(bytes1, bytes2);
*
*
* @param expected The expected bytes values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the bytes in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(byte[]...)
*/
public T hasValues(byte[]... expected);
/**
* Verifies that the values of a column are equal to texts.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* the texts in parameter :
*
*
*
* assertThat(table).column().hasValues("text", "text2", "text3");
*
*
* @param expected The expected text values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the texts in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(String...)
*/
public T hasValues(String... expected);
/**
* Verifies that the values of a column are equal to date values.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* the date values in parameter :
*
*
*
* assertThat(table).column().hasValues(DateValue.of(2014, 7, 7), DateValue.of(2014, 10, 3),
* DateValue.of(2014, 12, 23));
*
*
* @param expected The expected date values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the date values in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(DateValue...)
*/
public T hasValues(DateValue... expected);
/**
* Verifies that the values of a column are equal to time values.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* the time values in parameter :
*
*
*
* assertThat(table).column().hasValues(TimeValue.of(21, 29, 30), TimeValue.of(10, 1, 25), TimeValue.of(9, 1));
*
*
* @param expected The expected time values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the time values in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(TimeValue...)
*/
public T hasValues(TimeValue... expected);
/**
* Verifies that the values of a column are equal to date/time values.
*
* Example where the assertion verifies that the values in the first {@code Column} of the {@code Table} are equal to
* the date/time values in parameter :
*
*
*
* assertThat(table).column().hasValues(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29)),
* DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(10, 1, 25)),
* DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(9, 1)));
*
*
* @param expected The expected date/time values.
* @return {@code this} assertion object.
* @throws AssertionError If the values of the column are not equal to the date/time values in parameter.
* @see org.assertj.db.api.AbstractColumnAssert#hasValues(DateTimeValue...)
*/
public T hasValues(DateTimeValue... expected);
}