org.assertj.db.navigation.ToColumnFromChange 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.navigation;
import org.assertj.db.navigation.element.ColumnElement;
/**
* Defines methods to navigate to a modified {@link org.assertj.db.type.Column} from a {@link org.assertj.db.type.Change}.
* The different methods return an assertion on one column {@link org.assertj.db.navigation.element.ColumnElement}.
* These methods exists when navigating (at the beginning {@code assertThat()}) from changes.
* The difference with {@link ToColumn} is that {@link ToColumn}
* allows to navigate in all the columns of a {@link org.assertj.db.type.Change} and the methods
* of {@link ToColumnFromChange} count only the columns
* with a modification between the start point and the end point.
*
* As shown in the diagram below, it is possible to call the method to navigate to a {@link org.assertj.db.navigation.element.ColumnElement} from :
*
* - a change ({@link org.assertj.db.api.ChangeAssert})
* - a column of a change ({@link org.assertj.db.api.ChangeColumnAssert})
* - a value of a column of a change ({@link org.assertj.db.api.ChangeColumnValueAssert})
* - a row of a change ({@link org.assertj.db.api.ChangeRowAssert})
* - a value of a row of a change ({@link org.assertj.db.api.ChangeRowValueAssert})
*
*
*
*
* It is important to keep in mind that the methods are executed from the point of view of the last instance with assertion methods on a change ({@link org.assertj.db.api.ChangeAssert}).
* So all the lines of code below are equivalent : they point on the column at index 1 (as usual, the list start at index 0) among the modified columns.
*
*
*
* assertThat(changes).change().columnAmongTheModifiedOnes(1)......; // Point directly on the column at index 1
* // Use the returnToChange() method to return on the change and access to the next/second column of the list
* assertThat(changes).change().columnAmongTheModifiedOnes().returnToChange().columnAmongTheModifiedOnes()......;
* assertThat(changes).change().columnAmongTheModifiedOnes().columnAmongTheModifiedOnes()......; // Same as precedent but returnToChange() is implicit
* assertThat(changes).change().column().columnAmongTheModifiedOnes(1)......; // The method with the index can be call too
* assertThat(changes).change().columnAmongTheModifiedOnes(2).column(0).columnAmongTheModifiedOnes(1)......; // Idem
* assertThat(changes).change().columnAmongTheModifiedOnes().value().columnAmongTheModifiedOnes()......;
* assertThat(changes).change().column().value().columnAmongTheModifiedOnes(1)......;
* // Equivalent to the precedent but with the use of the methods to return to origin
* assertThat(changes).change().columnAmongTheModifiedOnes().value().returnToColumn().returnToChange().columnAmongTheModifiedOnes(1)......;
*
*
*
* @author Régis Pouiller
*
* @param The class of a assertion on a column (an sub-class of {@link org.assertj.db.navigation.element.ColumnElement}).
*/
public interface ToColumnFromChange extends Navigation {
/**
* Returns assertion methods on the next {@link org.assertj.db.type.Column} in the list of the modified {@link org.assertj.db.type.Column}s.
*
* @return An object to make assertions on the {@link org.assertj.db.type.Column}.
* @throws org.assertj.db.exception.AssertJDBException If there are no more {@link org.assertj.db.type.Column} among the list of modified {@link org.assertj.db.type.Column}s.
* @see org.assertj.db.api.ChangeAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeColumnAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeColumnValueAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeRowAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeRowValueAssert#columnAmongTheModifiedOnes(String)
*/
C columnAmongTheModifiedOnes();
/**
* Returns assertion methods on the {@link org.assertj.db.type.Column} at the {@code index} in parameter among the modified {@link org.assertj.db.type.Column}s.
*
* @param index The index corresponding to the {@link org.assertj.db.type.Column} among the list of modified {@link org.assertj.db.type.Column}s..
* @return An object to make assertions on the {@link org.assertj.db.type.Column}.
* @throws org.assertj.db.exception.AssertJDBException If the {@code index} is out of the bounds.
* @see org.assertj.db.api.ChangeAssert#columnAmongTheModifiedOnes(int)
* @see org.assertj.db.api.ChangeColumnAssert#columnAmongTheModifiedOnes(int)
* @see org.assertj.db.api.ChangeColumnValueAssert#columnAmongTheModifiedOnes(int)
* @see org.assertj.db.api.ChangeRowAssert#columnAmongTheModifiedOnes(int)
* @see org.assertj.db.api.ChangeRowValueAssert#columnAmongTheModifiedOnes(int)
*/
C columnAmongTheModifiedOnes(int index);
/**
* Returns assertion methods on the {@link org.assertj.db.type.Column} corresponding to the column name in parameter among the modified {@link org.assertj.db.type.Column}s.
*
* @param columnName The column name.
* @return An object to make assertions on the {@link org.assertj.db.type.Column}.
* @throws NullPointerException If the column name in parameter is {@code null}.
* @throws org.assertj.db.exception.AssertJDBException If there is no column with this name among the list of modified {@link org.assertj.db.type.Column}s.
* @see org.assertj.db.api.ChangeAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeColumnAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeColumnValueAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeRowAssert#columnAmongTheModifiedOnes(String)
* @see org.assertj.db.api.ChangeRowValueAssert#columnAmongTheModifiedOnes(String)
*/
C columnAmongTheModifiedOnes(String columnName);
}