/tags/fest-swing-1.0b1/src/test/java/org/fest/swing/fixture/TableCellTest.java
http://fest.googlecode.com/ · Java · 68 lines · 38 code · 10 blank · 20 comment · 0 complexity · 7148bdedb09e0628430addb281318538 MD5 · raw file
- /*
- * Created on Sep 22, 2007
- *
- * 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 @2007-2008 the original author or authors.
- */
- package org.fest.swing.fixture;
- import javax.swing.JTable;
- import org.testng.annotations.Test;
- import static org.fest.assertions.Assertions.assertThat;
- /**
- * Tests for <code>{@link TableCell}</code>.
- *
- * @author Alex Ruiz
- */
- public class TableCellTest {
- @Test public void shouldCreateTableCellWithGivenRowAndColumn() {
- int row = 6;
- int column = 8;
- TableCell cell = TableCell.row(row).column(column);
- assertThat(cell.row).isEqualTo(row);
- assertThat(cell.column).isEqualTo(column);
- }
-
- @Test(expectedExceptions = IndexOutOfBoundsException.class)
- public void shouldThrowErrorIfTableIsEmpty() {
- TableCell cell = TableCell.row(2).column(3);
- cell.validateBoundsIn(new JTable());
- }
- @Test(expectedExceptions = IndexOutOfBoundsException.class)
- public void shouldThrowErrorIfRowIndexIsNegative() {
- TableCell cell = TableCell.row(-2).column(3);
- cell.validateBoundsIn(new JTable(4, 3));
- }
- @Test(expectedExceptions = IndexOutOfBoundsException.class)
- public void shouldThrowErrorIfColumnIndexIsNegative() {
- TableCell cell = TableCell.row(2).column(-3);
- cell.validateBoundsIn(new JTable(4, 3));
- }
-
- @Test(expectedExceptions = IndexOutOfBoundsException.class)
- public void shouldThrowErrorIfRowIsOutOfBounds() {
- TableCell cell = TableCell.row(4).column(2);
- cell.validateBoundsIn(new JTable(4, 3));
- }
-
- @Test(expectedExceptions = IndexOutOfBoundsException.class)
- public void shouldThrowErrorIfColumnIsOutOfBounds() {
- TableCell cell = TableCell.row(0).column(3);
- cell.validateBoundsIn(new JTable(4, 3));
- }
- }