BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
voltage_provider/QuickcheckProperties.java
1 package unit.kernel.models.variables.voltage_provider;
2 
3 import com.pholser.junit.quickcheck.Property;
4 import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
6 import org.jetbrains.annotations.Contract;
7 import org.junit.Assume;
8 import org.junit.Rule;
9 import org.junit.rules.ExpectedException;
10 import org.junit.runner.RunWith;
11 
12 import java.time.Duration;
13 
14 import static org.junit.Assert.assertEquals;
15 import static org.junit.Assert.fail;
16 
20 @RunWith(JUnitQuickcheck.class)
21 public final class QuickcheckProperties extends VoltageProviderTestCase {
22 
23  @Contract(" -> !null")
24  @Override
25  protected ExpectationsForTest getExpectations(){
26  return new ExpectationsForTest();
27  }
28 
29  @Rule
30  public ExpectedException thrown = ExpectedException.none();
31 
32  @Property
33  public void numberOfDataPoints(Integer dataPoints){
34  provider.setNumberOfDataPoints(dataPoints);
35  assertEquals(dataPoints, provider.getNumberOfDataPoints());
36  }
37 
38  @Property
39  public void pollingIntervalBiggerThanZero(Duration pollingInterval){
40  Assume.assumeFalse(pollingInterval.isNegative());
41 
42  try {
43  provider.setPollingInterval(pollingInterval);
44  } catch (NegativeDurationException error){
45  fail();
46  }
47 
48  assertEquals(pollingInterval, provider.getPollingInterval());
49  }
50 
51  @Property
52  public void pollingIntervalLessThanZero(Duration pollingInterval) throws
54  Assume.assumeTrue(pollingInterval.isNegative());
55 
56  thrown.expect(NegativeDurationException.class);
57  provider.setPollingInterval(pollingInterval);
58  }
59 }
Git Repo