]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix ContainerSizeChangeTest not to produce failure shots every time.
authorSauli Tähkäpää <sauli@vaadin.com>
Fri, 3 Oct 2014 05:14:48 +0000 (08:14 +0300)
committerSauli Tähkäpää <sauli@vaadin.com>
Fri, 3 Oct 2014 05:15:13 +0000 (08:15 +0300)
Change-Id: I3cacc581d6991e6b760e2b3ae43a63dafac071b3

uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeTest.java

index 041b23749cc83bbab3424a12166bd4ef82a69aa0..e13238e10d31d1bf524c1a376deb47c3eb51cfa6 100644 (file)
@@ -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));
+        }
     }
 }