BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
pvci_pressure_gauge_factory/GetPressureGauge.java
1 package unit.kernel.models.pvci_pressure_gauge_factory;
2 
5 import org.jmock.Expectations;
6 import org.junit.Before;
7 import org.junit.Test;
8 
9 import static org.junit.Assert.assertNotNull;
10 
15  private PressureGauge mockPressureGauge = context.mock(
16  PressureGauge.class
17  );
18 
19  @Before
20  public void setContext(){
21  context.checking(new ExpectationsForTest());
22  }
23 
24  @Test
25  public void getPressureGauge() throws Exception{
26  assertNotNull(factory.getPressureGauge());
27  }
28 
29  private class ExpectationsForTest extends Expectations {
30  public ExpectationsForTest(){
31 
32  oneOf(mockKernel).getDeviceRegistryView();
33  will(returnValue(mockRegistry));
34 
35  oneOf(mockRegistry).hasPressureGauge();
36  will(returnValue(Boolean.TRUE));
37 
38  oneOf(mockRegistry).getPressureGauge();
39  will(returnValue(mockPressureGauge));
40  }
41  }
42 }
final Mockery context
Git Repo