From 71e16a6bfaafb51c623f64b84d711ce1385106e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sauli=20T=C3=A4hk=C3=A4p=C3=A4=C3=A4?= Date: Fri, 3 Oct 2014 08:14:48 +0300 Subject: [PATCH] Fix ContainerSizeChangeTest not to produce failure shots every time. Change-Id: I3cacc581d6991e6b760e2b3ae43a63dafac071b3 --- .../components/table/ContainerSizeChangeTest.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeTest.java b/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeTest.java index 041b23749c..e13238e10d 100644 --- a/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeTest.java +++ b/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeTest.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.table; +import static junit.framework.TestCase.fail; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -19,9 +20,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class ContainerSizeChangeTest extends MultiBrowserTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test public void tableShouldLoadCorrectItems() throws IOException, InterruptedException { @@ -52,11 +50,12 @@ public class ContainerSizeChangeTest extends MultiBrowserTest { } private void assertRowDoesNotExist(TableElement table, int rowIndex) { - // This is a really crappy way to workaround JUnit's limitation to - // provide a proper assert.throws method... - thrown.expect(NoSuchElementException.class); - table.getCell(rowIndex, 0); + try { + table.getCell(rowIndex, 0); + + fail(String.format("Row %s should not exists.", rowIndex)); + } catch (NoSuchElementException e) { - Assert.fail(String.format("Row %s should not exists.", rowIndex)); + } } } -- 2.39.5