BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
HandleRefreshButtonClickedPowerSupply.java
1 package unit.ui.controllers.device_list_controller;
2 
3 import javafx.scene.text.Text;
5 import org.jmock.Expectations;
6 import org.jmock.Mockery;
7 import org.junit.Before;
8 import org.junit.Test;
9 
10 import java.util.Optional;
11 
12 import static org.junit.Assert.fail;
13 
18 public final class HandleRefreshButtonClickedPowerSupply extends
20 
21  @Before
22  public void setUpForNoPowerSupply() {
23  applicationContext.getBean(Mockery.class).checking(
24  new ExpectationsForNoPowerSupply()
25  );
26  }
27 
28  @Test
29  public void testNoPowerSupply() {
30 
31  clickOn(queryForRefreshButton);
32 
33  Optional<Text> message = lookup(queryForNoPowerSupply).tryQuery();
34 
35  if (!message.isPresent()) {
36  fail("The test did not make the no-power-supply message appear");
37  }
38  }
39 
40 
41  private class ExpectationsForNoPowerSupply extends Expectations {
42  public ExpectationsForNoPowerSupply() {
43  oneOf(applicationContext.getBean(DeviceContainer.class))
44  .hasPowerSupply();
45  will(returnValue(Boolean.FALSE));
46 
47  oneOf(applicationContext.getBean(DeviceContainer.class))
48  .hasPressureGauge();
49  will(returnValue(Boolean.FALSE));
50  }
51  }
52 }
Git Repo