1 package unit.ui.controllers.device_list_controller;
4 import javafx.scene.text.Text;
6 import org.jmock.Expectations;
7 import org.jmock.Mockery;
8 import org.junit.Before;
11 import java.util.Optional;
13 import static org.junit.Assert.fail;
23 public void setContext(){
24 applicationContext.getBean(Mockery.class).checking(
25 new ExpectationsForTest()
30 public void testPressureGauge(){
31 clickOn(queryForRefreshButton);
33 Optional<Text> message = lookup(queryForPressureGaugeMessage)
36 if (!message.isPresent()){
37 String failMessage = String.format(
38 "The test did not make the message with id %s appear",
39 queryForPressureGaugeMessage
45 private class ExpectationsForTest
extends Expectations {
51 private final PressureGauge gauge = applicationContext.getBean
54 public ExpectationsForTest(){
55 oneOf(registry).hasPowerSupply();
56 will(returnValue(Boolean.FALSE));
58 oneOf(registry).hasPressureGauge();
59 will(returnValue(Boolean.TRUE));
61 oneOf(registry).getPressureGauge();
62 will(returnValue(gauge));