*/
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;
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");
assertEquals("123", l.getValue());
}
+ @Test
public void testIntegerDataSource() {
VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
Label l = new Label("Foo");
l.getValue());
}
+ @Test
public void testSetValueWithDataSource() {
try {
MethodProperty<String> property = new MethodProperty<String>(
}
+ @Test
public void testLabelWithoutDataSource() {
Label l = new Label("My label");
assertEquals("My label", l.getValue());
import org.easymock.EasyMock;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import com.vaadin.server.VaadinRequest;
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();
@Test
public void testClearedAfterRemoveInheritable() throws Exception {
+ CurrentInstance.clearAll();
+
CurrentInstance.setInheritable(CurrentInstanceTest.class, this);
Assert.assertEquals(this,
CurrentInstance.get(CurrentInstanceTest.class));