aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java
blob: d4e1ecb5ce6166e6ad2b140761fcfc1a03fd5d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.vaadin.tests.components.ui;

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

import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class CurrentUiRetainedTest extends MultiBrowserTest {
    @Test
    public void testCurrentUiRetained() throws Exception {
        openTestURL();
        $(ButtonElement.class).first().click();
        assertLogText(3, "1. Correct UI.getCurrent before GC: true");
        assertLogText(2, "2. Correct UI.getCurrent after GC: true");
        assertLogText(1, "3. GC probe available before GC: true");
        assertLogText(0, "4. GC probe available after GC: false");
    }

    private void assertLogText(int index, String expected) {
        Assert.assertEquals("Unexpected log contents,", expected,
                getLogRow(index));
    }
}