Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try not to lose the weak reference of UI during the test #4431

Merged
merged 1 commit into from
Jul 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.OutputStream;

import org.junit.Assert;
import org.junit.Test;

import com.vaadin.flow.component.Component;
Expand Down Expand Up @@ -45,19 +46,18 @@ public void htmlComponentAndHtmlContainer() throws Throwable {
*/
@Test
public void streamResource() throws Throwable {
UI.setCurrent(new UI());
UI ui = new UI();
UI.setCurrent(ui);
try {
Element element = new Element("dummy-element");
StreamReceiver streamReceiver = new StreamReceiver(
element.getNode(), "upload", new MyStreamVariable());
Assert.assertEquals(ui, UI.getCurrent());
element.setAttribute("target", streamReceiver);
serializeAndDeserialize(element);
assertTrue("Basic smoke test with ",
element.getAttribute("target").length() > 10);

} catch (Throwable e) {
e.printStackTrace();
throw e;
} finally {
UI.setCurrent(null);
}
Expand Down