You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ThreadLocalInstancesTest.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.vaadin.tests.application;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. import com.vaadin.testbench.elements.ButtonElement;
  5. import com.vaadin.tests.tb3.MultiBrowserTest;
  6. public class ThreadLocalInstancesTest extends MultiBrowserTest {
  7. @Test
  8. public void tb2test() throws Exception {
  9. openTestURL();
  10. $(ButtonElement.class).first().click();
  11. assertLogText("1. some app in class init", 15);
  12. assertLogText("2. null root in class init", 14);
  13. assertLogText("3. some app in app constructor", 13);
  14. assertLogText("4. null root in app constructor", 12);
  15. assertLogText("5. some app in app init", 11);
  16. assertLogText("6. null root in app init", 10);
  17. assertLogText("7. some app in root init", 9);
  18. assertLogText("8. this root in root init", 8);
  19. assertLogText("9. some app in root paint", 7);
  20. assertLogText("10. this root in root paint", 6);
  21. assertLogText("11. null app in background thread", 5);
  22. assertLogText("12. null root in background thread", 4);
  23. assertLogText("13. some app in resource handler", 3);
  24. assertLogText("14. this root in resource handler", 2);
  25. assertLogText("15. some app in button listener", 1);
  26. assertLogText("16. this root in button listener", 0);
  27. }
  28. private void assertLogText(String expected, int index) {
  29. assertEquals("Incorrect log text,", expected, getLogRow(index));
  30. }
  31. }