1 | package geniusweb.exampleparties.humangui;
|
---|
2 |
|
---|
3 | import static org.mockito.Mockito.mock;
|
---|
4 |
|
---|
5 | import java.awt.BorderLayout;
|
---|
6 | import java.awt.Container;
|
---|
7 | import java.io.IOException;
|
---|
8 | import java.net.URI;
|
---|
9 | import java.net.URISyntaxException;
|
---|
10 |
|
---|
11 | import javax.swing.JFrame;
|
---|
12 | import javax.websocket.DeploymentException;
|
---|
13 |
|
---|
14 | import org.junit.After;
|
---|
15 | import org.junit.Before;
|
---|
16 | import org.junit.Test;
|
---|
17 |
|
---|
18 | import geniusweb.actions.Action;
|
---|
19 | import geniusweb.actions.PartyId;
|
---|
20 | import geniusweb.connection.ConnectionEnd;
|
---|
21 | import geniusweb.inform.Inform;
|
---|
22 | import geniusweb.inform.Settings;
|
---|
23 | import geniusweb.profileconnection.ProfileConnectionFactory;
|
---|
24 | import geniusweb.profileconnection.ProfileInterface;
|
---|
25 | import geniusweb.progress.ProgressRounds;
|
---|
26 | import geniusweb.references.Parameters;
|
---|
27 | import geniusweb.references.ProfileRef;
|
---|
28 | import geniusweb.references.ProtocolRef;
|
---|
29 | import tudelft.utilities.logging.Reporter;
|
---|
30 |
|
---|
31 | public class MyGUITest {
|
---|
32 | private final ProtocolRef protocol = mock(ProtocolRef.class);
|
---|
33 | private final ProgressRounds progress = mock(ProgressRounds.class);
|
---|
34 | private static final String PROFILE = "src/test/resources/testprofile.json";
|
---|
35 | private final Parameters parameters = new Parameters();
|
---|
36 | private Reporter reporter = mock(Reporter.class);
|
---|
37 | private MyGUI gui;
|
---|
38 | private JFrame frame;
|
---|
39 | private BiddingInfo info;
|
---|
40 |
|
---|
41 | @Before
|
---|
42 | public void before()
|
---|
43 | throws IOException, DeploymentException, URISyntaxException {
|
---|
44 | Settings settings = new Settings(new PartyId("party1"),
|
---|
45 | new ProfileRef(new URI("file:" + PROFILE)), protocol, progress,
|
---|
46 | parameters);
|
---|
47 |
|
---|
48 | ProfileInterface profileint = ProfileConnectionFactory
|
---|
49 | .create(settings.getProfile().getURI(), reporter);
|
---|
50 | ConnectionEnd<Inform, Action> conn = mock(ConnectionEnd.class);
|
---|
51 | info = new BiddingInfo(settings, conn, reporter, profileint);
|
---|
52 | gui = new MyGUI(info);
|
---|
53 |
|
---|
54 | // not strictly necesary but useful to visually check the process
|
---|
55 | frame = new JFrame();
|
---|
56 | Container content = frame.getContentPane();
|
---|
57 | content.setLayout(new BorderLayout());
|
---|
58 | content.add(gui, BorderLayout.CENTER);
|
---|
59 | frame.pack();
|
---|
60 | frame.setVisible(true);
|
---|
61 |
|
---|
62 | }
|
---|
63 |
|
---|
64 | @After
|
---|
65 | public void after() {
|
---|
66 | frame.setVisible(false);
|
---|
67 | }
|
---|
68 |
|
---|
69 | @Test
|
---|
70 | public void smokeTest() throws IOException, DeploymentException,
|
---|
71 | URISyntaxException, InterruptedException {
|
---|
72 | Thread.sleep(2000);
|
---|
73 | }
|
---|
74 |
|
---|
75 | }
|
---|