org.assertj.db.api.assertions.AssertOnValueEquality 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-2016 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;
import java.util.UUID;
/**
* Defines the assertion methods on the equality of a value.
*
* @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
* @author Otoniel Isidoro
*/
public interface AssertOnValueEquality> {
/**
* Verifies that the value is equal to a boolean.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to french Locale :
*
*
*
*
* assertThat(table).row().value().isEqualTo(Locale.FRENCH);
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to french Locale :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(Locale.FRENCH);
*
*
*
* @param expected The expected object value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the object in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(Object)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(Object)
*/
T isEqualTo(Object expected);
/**
* Verifies that the value is equal to a boolean.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to true boolean :
*
*
*
*
* assertThat(table).row().value().isEqualTo(true);
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to true boolean :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(true);
*
*
*
* @param expected The expected boolean value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the boolean in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(Boolean)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(Boolean)
*/
T isEqualTo(Boolean expected);
/**
* Verifies that the value is equal to true boolean.
*
* Example with the value in the first {@code Column} of the first {@code Row} of the {@code Table} :
*
*
*
*
* assertThat(table).row().value().isTrue();
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isTrue();
*
*
*
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to true boolean.
* @see org.assertj.db.api.AbstractValueAssert#isTrue()
* @see org.assertj.db.api.AbstractAssertWithValues#isTrue()
*/
T isTrue();
/**
* Verifies that the value is equal to false boolean.
*
* Example with the value in the first {@code Column} of the first {@code Row} of the {@code Table} :
*
*
*
*
* assertThat(table).row().value().isFalse();
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isFalse();
*
*
*
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to false boolean.
* @see org.assertj.db.api.AbstractValueAssert#isFalse()
* @see org.assertj.db.api.AbstractAssertWithValues#isFalse()
*/
T isFalse();
/**
* Verifies that the value is equal to a number.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to number 3 :
*
*
*
*
* assertThat(table).row().value().isEqualTo(3);
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to number 3 :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(3);
*
*
*
* @param expected The expected number value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the number in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(Number)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(Number)
*/
T isEqualTo(Number expected);
/**
* Verifies that the value is equal to a array of bytes.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to a array of bytes loaded from a file in the classpath :
*
*
*
*
* byte[] bytes = bytesContentFromClassPathOf("file.png");
* assertThat(table).row().value().isEqualTo(bytes);
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to a array of bytes loaded from a file in the classpath :
*
*
*
*
* byte[] bytes = bytesContentFromClassPathOf("file.png");
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(bytes);
*
*
*
* @param expected The expected array of bytes value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the array of bytes in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(byte[])
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(byte[])
*/
T isEqualTo(byte[] expected);
/**
* Verifies that the value is equal to a text.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to a text :
*
*
*
*
* assertThat(table).row().value().isEqualTo("text");
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to a text :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo("text");
*
*
*
* @param expected The expected text value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the text in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(String)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(String)
*/
T isEqualTo(String expected);
/**
* Verifies that the value is equal to a character.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to a character :
*
*
*
*
* assertThat(table).row().value().isEqualTo('c');
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to a character :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo('c');
*
*
*
* @param expected The expected character value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the character in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(Character)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(Character)
* @since 1.2.0
*/
T isEqualTo(Character expected);
/**
* Verifies that the value is equal to an UUID.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to an UUID :
*
*
*
*
* assertThat(table).row().value().isEqualTo(UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"));
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to an UUID :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"));
*
*
*
* @param expected The expected UUID value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the UUID in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(UUID)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(UUID)
* @since 1.1.0
*/
T isEqualTo(UUID expected);
/**
* Verifies that the value is equal to a date value.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to a date value :
*
*
*
*
* assertThat(table).row().value().isEqualTo(DateValue.of(2014, 7, 7));
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to a date value :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(DateValue.of(2014, 7, 7));
*
*
*
* @param expected The expected date value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the date value in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(DateValue)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(DateValue)
*/
T isEqualTo(DateValue expected);
/**
* Verifies that the value is equal to a time value.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to a time value :
*
*
*
*
* assertThat(table).row().value().isEqualTo(TimeValue.of(21, 29, 30));
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to a time value :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(TimeValue.of(21, 29, 30));
*
*
*
* @param expected The expected time value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the time value in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(TimeValue)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(TimeValue)
*/
T isEqualTo(TimeValue expected);
/**
* Verifies that the value is equal to a date/time value.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to a date/time value :
*
*
*
*
* assertThat(table).row().value().isEqualTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29)));
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to a date/time value :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isEqualTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29)));
*
*
*
* @param expected The expected date/time value.
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to the date/time value in parameter.
* @see org.assertj.db.api.AbstractValueAssert#isEqualTo(DateTimeValue)
* @see org.assertj.db.api.AbstractAssertWithValues#isEqualTo(DateTimeValue)
*/
T isEqualTo(DateTimeValue expected);
/**
* Verifies that the value is equal to zero.
*
* Example where the assertion verifies that the value in the first {@code Column} of the first {@code Row} of the
* {@code Table} is equal to zero :
*
*
*
*
* assertThat(table).row().value().isZero();
*
*
*
* Example where the assertion verifies that the value in the first {@code Column} of the {@code Row} at end point
* of the first {@code Change} is equal to zero :
*
*
*
*
* assertThat(changes).change().rowAtEndPoint().value().isZero();
*
*
*
* @return {@code this} assertion object.
* @throws AssertionError If the value is not equal to zero.
* @see org.assertj.db.api.AbstractValueAssert#isZero()
* @see org.assertj.db.api.AbstractAssertWithValues#isZero()
*/
T isZero();
}