All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.assertj.db.navigation.ToRow Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
/**
 * 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.exception.AssertJDBException;
import org.assertj.db.navigation.element.RowElement;
import org.assertj.db.type.Row;

/**
 * Defines methods to navigate to a {@link org.assertj.db.type.Row}.
 * 

The different methods return an assertion on one row {@link org.assertj.db.navigation.element.RowElement}.

*

These methods exists when navigating (at the beginning {@code assertThat()}) from a {@link org.assertj.db.type.Table} or from a {@link org.assertj.db.type.Request}.

*

As shown in the diagram below, it is possible to call the method to navigate to a {@link org.assertj.db.navigation.element.RowElement} from :

*
    *
  • a table ({@link org.assertj.db.api.TableAssert})
  • *
  • a request ({@link org.assertj.db.api.RequestAssert})
  • *
  • a column ({@link org.assertj.db.api.AbstractColumnAssert})
  • *
  • a value of a column ({@link org.assertj.db.api.AbstractColumnValueAssert})
  • *
  • a row ({@link org.assertj.db.api.AbstractRowAssert})
  • *
  • a value of a row ({@link org.assertj.db.api.AbstractRowValueAssert})
  • *
*

* diagram with navigation to row *

*

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 table ({@link org.assertj.db.api.TableAssert}) or on a request ({@link org.assertj.db.api.RequestAssert}).
* So all the lines of code below are equivalent : they point on the row at index 1 (as usual, the list start at index 0). *

*
 * 
 * assertThat(table_or_request).row(1)......;                             // Point directly on the row at index 1
 * assertThat(table).row().returnToTable().row()......;                   // Use the returnToTable() method to return on the table
 *                                                                        // and access to the next/second row of the list
 * assertThat(request).row().returnToRequest().row()......;               // Use the returnToRequest() method to return on the request
 *                                                                        // and access to the next/second row of the list
 * assertThat(table_or_request).row().row()......;                        // Same as two precedent but returnToTable() or returnToRequest() is implicit
 * assertThat(table_or_request).row().row(1)......;                       // The method with the index can be call too
 * assertThat(table_or_request).row(2).row(0).row(1)......;               // Idem
 * assertThat(table_or_request).row().value().row()......;
 * assertThat(table_or_request).row().value().row(1)......;
 * // Equivalent to the precedent but with the use of the methods to return to origin
 * assertThat(table).row().value().returnToRow().returnToTable().row(1)......;
 * assertThat(request).row().value().returnToRow().returnToRequest().row(1)......;
 * 
 * 
* * @author Régis Pouiller * * @param The class of a assertion on a row (an sub-class of {@link org.assertj.db.navigation.element.RowElement}). */ public interface ToRow extends Navigation { /** * Returns assertion methods on the next {@link org.assertj.db.type.Row} in the list of {@link org.assertj.db.type.Row}. * * @return An object to make assertions on the next {@link Row}. * @throws AssertJDBException If there are no more {@link org.assertj.db.type.Row} in the list of {@link org.assertj.db.type.Row}s. * @see org.assertj.db.api.TableAssert#row() * @see org.assertj.db.api.RequestAssert#row() * @see org.assertj.db.api.AbstractColumnAssert#row() * @see org.assertj.db.api.AbstractColumnValueAssert#row() * @see org.assertj.db.api.AbstractRowAssert#row() * @see org.assertj.db.api.AbstractRowValueAssert#row() */ R row(); /** * Returns assertion methods on the {@link org.assertj.db.type.Row} at the {@code index} in parameter. * * @param index The index corresponding to the {@link org.assertj.db.type.Row}. * @return An object to make assertions on the {@link org.assertj.db.type.Row}. * @throws AssertJDBException If the {@code index} is out of the bounds. * @see org.assertj.db.api.TableAssert#row(int) * @see org.assertj.db.api.RequestAssert#row(int) * @see org.assertj.db.api.AbstractColumnAssert#row(int) * @see org.assertj.db.api.AbstractColumnValueAssert#row(int) * @see org.assertj.db.api.AbstractRowAssert#row(int) * @see org.assertj.db.api.AbstractRowValueAssert#row(int) */ R row(int index); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy