Selaa lähdekoodia

Make server unit tests pass in Eclipse (#16581)

Change-Id: Ieb9d00fe8412ed6fb0921d07e0511eb922268375
tags/7.4.0.rc1
Artur Signell 9 vuotta sitten
vanhempi
commit
a9f103245a

+ 1
- 0
server/tests/src/com/vaadin/tests/server/ClassesSerializableTest.java Näytä tiedosto

@@ -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", //
};

/**

+ 17
- 2
server/tests/src/com/vaadin/tests/server/component/label/LabelConvertersTest.java Näytä tiedosto

@@ -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());

+ 9
- 0
server/tests/src/com/vaadin/util/CurrentInstanceTest.java Näytä tiedosto

@@ -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));

Loading…
Peruuta
Tallenna