|
| 1 | +package edu.wpi.grip.core.composite; |
| 2 | + |
| 3 | +import com.google.inject.Guice; |
| 4 | +import com.google.inject.Inject; |
| 5 | +import com.google.inject.Injector; |
| 6 | +import edu.wpi.grip.core.FileManager; |
| 7 | +import edu.wpi.grip.core.operations.composite.SaveImageOperation; |
| 8 | +import edu.wpi.grip.core.sockets.InputSocket; |
| 9 | +import edu.wpi.grip.core.sockets.OutputSocket; |
| 10 | +import edu.wpi.grip.util.GRIPCoreTestModule; |
| 11 | +import org.junit.After; |
| 12 | +import org.junit.Before; |
| 13 | +import org.junit.Test; |
| 14 | + |
| 15 | +import static org.junit.Assert.assertFalse; |
| 16 | + |
| 17 | +public class SaveImageOperationTest { |
| 18 | + |
| 19 | + private GRIPCoreTestModule testModule; |
| 20 | + |
| 21 | + private InputSocket<Boolean> activeSocket; |
| 22 | + |
| 23 | + @Inject |
| 24 | + private InputSocket.Factory isf; |
| 25 | + |
| 26 | + @Inject |
| 27 | + private OutputSocket.Factory osf; |
| 28 | + |
| 29 | + @Inject |
| 30 | + private FileManager fileManager; |
| 31 | + |
| 32 | + @Before |
| 33 | + public void setUp() throws Exception { |
| 34 | + testModule = new GRIPCoreTestModule(); |
| 35 | + testModule.setUp(); |
| 36 | + |
| 37 | + final Injector injector = Guice.createInjector(testModule); |
| 38 | + injector.injectMembers(this); |
| 39 | + SaveImageOperation operation = new SaveImageOperation(isf, osf, fileManager); |
| 40 | + activeSocket = operation.getInputSockets().stream().filter(o -> o.getSocketHint().getIdentifier().equals("Active") && o.getSocketHint().getType().equals(Boolean.class)).findFirst().get(); |
| 41 | + } |
| 42 | + |
| 43 | + @After |
| 44 | + public void tearDown() { |
| 45 | + testModule.tearDown(); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void testActiveButtonDefaultsDisabled() { |
| 50 | + assertFalse("The active socket was not false (disabled).", activeSocket.getValue().get()); |
| 51 | + } |
| 52 | +} |
0 commit comments