]> source.dussan.org Git - vaadin-framework.git/commitdiff
Make server unit tests pass in Eclipse (#16581)
authorArtur Signell <artur@vaadin.com>
Wed, 4 Feb 2015 15:20:06 +0000 (17:20 +0200)
committerVaadin Code Review <review@vaadin.com>
Wed, 4 Feb 2015 19:42:35 +0000 (19:42 +0000)
Change-Id: Ieb9d00fe8412ed6fb0921d07e0511eb922268375

server/tests/src/com/vaadin/tests/server/ClassesSerializableTest.java
server/tests/src/com/vaadin/tests/server/component/label/LabelConvertersTest.java
server/tests/src/com/vaadin/util/CurrentInstanceTest.java

index 6e7b778f789f799cbf28ce03769426a1e31fc9d2..0de8fd6aab8453c7618f1bd07a06d2bdd2e33375 100644 (file)
@@ -79,6 +79,7 @@ public class ClassesSerializableTest extends TestCase {
             "com\\.vaadin\\.server\\.VaadinSession\\$FutureAccess", //
             "com\\.vaadin\\.external\\..*", //
             "com\\.vaadin\\.util\\.WeakValueMap.*", //
+            "com\\.vaadin\\.themes\\.valoutil\\.BodyStyleName", //
     };
 
     /**
index 7e65e6a0446992424b746beaa649e859c33d9b89..26961dc372dadad3233159c5094ff12f689821dc 100644 (file)
  */
 package com.vaadin.tests.server.component.label;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import org.junit.Before;
+import org.junit.Test;
 
 import com.vaadin.data.Property;
 import com.vaadin.data.util.MethodProperty;
@@ -23,9 +28,16 @@ import com.vaadin.server.VaadinSession;
 import com.vaadin.tests.data.bean.Person;
 import com.vaadin.tests.util.AlwaysLockedVaadinSession;
 import com.vaadin.ui.Label;
+import com.vaadin.util.CurrentInstance;
 
-public class LabelConvertersTest extends TestCase {
+public class LabelConvertersTest {
+    @Before
+    public void clearExistingThreadLocals() {
+        // Ensure no previous test left some thread locals hanging
+        CurrentInstance.clearAll();
+    }
 
+    @Test
     public void testLabelSetDataSourceLaterOn() {
         Person p = Person.createTestPerson1();
         Label l = new Label("My label");
@@ -37,6 +49,7 @@ public class LabelConvertersTest extends TestCase {
         assertEquals("123", l.getValue());
     }
 
+    @Test
     public void testIntegerDataSource() {
         VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
         Label l = new Label("Foo");
@@ -47,6 +60,7 @@ public class LabelConvertersTest extends TestCase {
                 l.getValue());
     }
 
+    @Test
     public void testSetValueWithDataSource() {
         try {
             MethodProperty<String> property = new MethodProperty<String>(
@@ -59,6 +73,7 @@ public class LabelConvertersTest extends TestCase {
 
     }
 
+    @Test
     public void testLabelWithoutDataSource() {
         Label l = new Label("My label");
         assertEquals("My label", l.getValue());
index 36055a036a681939c15d2cef988569a01d37fd29..5f9c9638e6d0f11437d9aef0750f1ab835dd9b90 100644 (file)
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.easymock.EasyMock;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 
 import com.vaadin.server.VaadinRequest;
@@ -32,6 +33,12 @@ import com.vaadin.ui.UI;
 
 public class CurrentInstanceTest {
 
+    @Before
+    public void clearExistingThreadLocals() {
+        // Ensure no previous test left some thread locals hanging
+        CurrentInstance.clearAll();
+    }
+
     @Test
     public void testInitiallyCleared() throws Exception {
         assertCleared();
@@ -49,6 +56,8 @@ public class CurrentInstanceTest {
 
     @Test
     public void testClearedAfterRemoveInheritable() throws Exception {
+        CurrentInstance.clearAll();
+
         CurrentInstance.setInheritable(CurrentInstanceTest.class, this);
         Assert.assertEquals(this,
                 CurrentInstance.get(CurrentInstanceTest.class));