source: exampleparties/humangui/src/test/java/geniusweb/exampleparties/humangui/MyGUITest.java@ 52

Last change on this file since 52 was 52, checked in by ruud, 14 months ago

Fixed small issues in domaineditor.

File size: 2.2 KB
Line 
1package geniusweb.exampleparties.humangui;
2
3import static org.mockito.Mockito.mock;
4
5import java.awt.BorderLayout;
6import java.awt.Container;
7import java.io.IOException;
8import java.net.URI;
9import java.net.URISyntaxException;
10
11import javax.swing.JFrame;
12import javax.websocket.DeploymentException;
13
14import org.junit.After;
15import org.junit.Before;
16import org.junit.Test;
17
18import geniusweb.actions.Action;
19import geniusweb.actions.PartyId;
20import geniusweb.connection.ConnectionEnd;
21import geniusweb.inform.Inform;
22import geniusweb.inform.Settings;
23import geniusweb.profileconnection.ProfileConnectionFactory;
24import geniusweb.profileconnection.ProfileInterface;
25import geniusweb.progress.ProgressRounds;
26import geniusweb.references.Parameters;
27import geniusweb.references.ProfileRef;
28import geniusweb.references.ProtocolRef;
29import tudelft.utilities.logging.Reporter;
30
31public 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}
Note: See TracBrowser for help on using the repository browser.