BakeoutController-Basic  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;
9 
10 import java.io.IOException;
11 
12 import static org.junit.Assert.fail;
13 
20 @Configuration
21 @Import(UserInterfaceConfiguration.class)
22 @Lazy
24  private volatile FXMLStage mockApplication;
25 
26  @Bean
27  @Scope("singleton")
28  public FXMLStage application(){
29  mockApplication = mockingContext().mock(FXMLStage.class);
30  mockingContext().checking(new ExpectationsForApplication());
31  return mockApplication;
32  }
33 
34 
35  private class ExpectationsForApplication extends Expectations {
36  public ExpectationsForApplication(){
37  expectationsForApplication();
38  }
39 
40  private void expectationsForApplication(){
41  try {
42  allowing(mockApplication).loadFXML();
43  } catch (IOException error){
44  fail("Failed mock initialization. This shouldn't happen");
45  }
46  allowing(mockApplication).show();
47  }
48  }
49 }
Git Repo