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;
22 public void setUpForPowerSupply() {
23 applicationContext.getBean(Mockery.class).checking(
24 new ExpectationsForPowerSupply()
29 public void testPowerSupply() {
30 clickOn(queryForRefreshButton);
32 Optional<Text> message = lookup(queryForPowerSupply).tryQuery();
34 if (!message.isPresent()) {
35 fail(
"The test did not make the power supply message appear");
39 private class ExpectationsForPowerSupply
extends Expectations {
40 public ExpectationsForPowerSupply() {
43 will(returnValue(Boolean.TRUE));
47 will(returnValue(applicationContext.getBean(
PowerSupply.class)));
51 will(returnValue(Boolean.FALSE));