BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
Start.java
1 package unit.ui.user_interface_launcher;
2 
3 import org.jmock.Expectations;
4 import org.jmock.Mockery;
5 import org.junit.Before;
6 import org.junit.Test;
7 import ui.FXMLStage;
9 
10 import java.io.IOException;
11 
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.fail;
14 
18 public final class Start extends UserInterfaceLauncherTestCase {
19  private JavaFXGraphicalUserInterfaceLauncher launcher;
20 
21  @Before
22  public void setLauncher(){
23  this.launcher = new JavaFXGraphicalUserInterfaceLauncher(applicationContext);
24  }
25 
26  @Test
27  public void start() throws Exception {
28  this.applicationContext.getBean(
29  Mockery.class
30  ).checking(new ExpectationsForSetPrimaryStage());
31 
32  this.launcher.start(stage);
33  assertNotNull(this.launcher);
34  }
35 
36  private class ExpectationsForSetPrimaryStage extends Expectations {
37  private final FXMLStage mockApplication = applicationContext.getBean(
38  FXMLStage.class
39  );
40 
41  public ExpectationsForSetPrimaryStage(){
42  oneOf(mockApplication).show();
43  loadFXMLExpectation();
44  }
45 
46  private void loadFXMLExpectation(){
47  try {
48  oneOf(mockApplication).loadFXML();
49  } catch (IOException error){
50  fail("Unable to set LoadFXML expectation. This shouldn't " +
51  "happen");
52  }
53  }
54  }
55 }
Git Repo