BakeoutController  0.1
A Controller for the Omicron vacuum chamber
UserInterfaceTestConfiguration.java
1 package unit.ui.user_interface_launcher;
2 
3 import org.jmock.Expectations;
4 import org.springframework.context.annotation.*;
5 import ui.FXMLStage;
8 
9 import java.io.IOException;
10 
11 import static org.junit.Assert.fail;
12 
19 @Configuration
20 @Import(UserInterfaceConfiguration.class)
21 @Lazy
23  private volatile FXMLStage mockApplication;
24 
25  @Bean
26  @Scope("singleton")
27  public FXMLStage application(){
28  mockApplication = mockingContext().mock(FXMLStage.class);
29  mockingContext().checking(new ExpectationsForApplication());
30  return mockApplication;
31  }
32 
33 
34  private class ExpectationsForApplication extends Expectations {
35  public ExpectationsForApplication(){
36  expectationsForApplication();
37  }
38 
39  private void expectationsForApplication(){
40  try {
41  allowing(mockApplication).loadFXML();
42  } catch (IOException error){
43  fail("Failed mock initialization. This shouldn't happen");
44  }
45  allowing(mockApplication).show();
46  }
47  }
48 }
Git Repo