1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package fr.ifremer.isisfish.ui;
26
27 import org.assertj.swing.edt.FailOnThreadViolationRepaintManager;
28 import org.assertj.swing.edt.GuiActionRunner;
29 import org.assertj.swing.edt.GuiQuery;
30 import org.assertj.swing.exception.WaitTimedOutError;
31 import org.assertj.swing.fixture.FrameFixture;
32 import org.junit.After;
33 import org.junit.Assume;
34 import org.junit.Before;
35 import org.junit.BeforeClass;
36
37 import fr.ifremer.isisfish.AbstractIsisFishTest;
38
39
40
41
42
43
44
45 public abstract class AbstractAssertjIT extends AbstractIsisFishTest {
46
47 protected FrameFixture mainWindow;
48
49 @BeforeClass
50 public static void setUpOnce() throws Exception {
51 Assume.assumeTrue(!java.awt.GraphicsEnvironment.isHeadless());
52 FailOnThreadViolationRepaintManager.install();
53 }
54
55 @Before
56 public void setUp() {
57 WelcomeUI frame = GuiActionRunner.execute(new GuiQuery<WelcomeUI>() {
58 protected WelcomeUI executeInEDT() {
59 return new WelcomeUI(new WelcomeContext());
60 }
61 });
62 mainWindow = new FrameFixture(frame);
63 try {
64 mainWindow.show();
65 } catch (WaitTimedOutError e) {
66
67 }
68 mainWindow.maximize();
69 }
70
71 @After
72 public void tearDown() {
73 mainWindow.cleanUp();
74 }
75 }