|
|
@@ -15,7 +15,12 @@ |
|
|
|
*/ |
|
|
|
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()); |