BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
ConstructorWithNoCommunication.java
1 package unit.devices.pvci_pressure_gauge;
2 
3 import com.ghgande.j2mod.modbus.msg.ModbusRequest;
5 import org.jmock.Expectations;
6 import org.junit.Before;
7 import org.junit.Test;
8 
9 import java.io.IOException;
10 
15 public final class ConstructorWithNoCommunication extends
17 
18  @Before
19  public void setContext() throws Exception {
20  context.checking(new ExpectationsForTest());
21  }
22 
23  @Test(expected = IOException.class)
24  public void construct() throws IOException {
25  new PVCiPressureGauge(address, mockModbusConnector);
26  }
27 
28 
29  private class ExpectationsForTest extends Expectations {
30  public ExpectationsForTest() throws Exception {
31  oneOf(mockModbusConnector).getTransactionForRequest(
32  with(any(ModbusRequest.class))
33  );
34  will(returnValue(mockTransaction));
35 
36  oneOf(mockModbusConnector).parseStringFromResponse(mockResponse);
37  will(returnValue(null));
38  }
39  }
40 }
final Mockery context
Git Repo