// Path: src/test/java/org/mandfer/categories/FastTest.java
// public interface FastTest {}
// 
// Path: src/test/java/org/mandfer/categories/SlowTest.java
// public interface SlowTest {}


import org.mandfer.categories.SlowTest;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.wiringpi.Gpio;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mandfer.categories.FastTest;

    public void setUp(){
        PowerMockito.mockStatic(Gpio.class);
        
        mocked_shockPin = mock(GpioPinDigitalInput.class);
        mocked_ledPin = mock(GpioPinDigitalOutput.class);
        sketch = new Ex06_ShockSwitch(mocked_gpioController);
    }
    
    @Test
    @Category(FastTest.class)
    public void verifySetup(){
        sketch.setup(NO_ARGS);
        
        PowerMockito.verifyStatic();
        Gpio.wiringPiSetup();
        
        verify(mocked_gpioController).provisionDigitalInputPin(RaspiPin.GPIO_00);
        verify(mocked_gpioController).provisionDigitalOutputPin(RaspiPin.GPIO_01);
        verifyNoMoreInteractions(mocked_gpioController);
    }    
    
    @Test
    @Category(SlowTest.class)
    public void testReadingShockSensor() throws InterruptedException{        
        when(mocked_gpioController.provisionDigitalInputPin(RaspiPin.GPIO_00)).thenReturn(mocked_shockPin);
        when(mocked_gpioController.provisionDigitalOutputPin(RaspiPin.GPIO_01)).thenReturn(mocked_ledPin);
        when(mocked_shockPin.isLow()).thenReturn(Boolean.TRUE);
        
        sketch.setup(NO_ARGS);
        sketch.setSketchInterruption();

// Path: src/test/java/org/mandfer/categories/FastTest.java
// public interface FastTest {}
// 
// Path: src/test/java/org/mandfer/categories/SlowTest.java
// public interface SlowTest {}


// Path: src/test/java/org/mandfer/sunfunpi4j/Ex06_ShockSwitchTest.java
import org.mandfer.categories.SlowTest;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.wiringpi.Gpio;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mandfer.categories.FastTest;

    public void setUp(){
        PowerMockito.mockStatic(Gpio.class);
        
        mocked_shockPin = mock(GpioPinDigitalInput.class);
        mocked_ledPin = mock(GpioPinDigitalOutput.class);
        sketch = new Ex06_ShockSwitch(mocked_gpioController);
    }
    
    @Test
    @Category(FastTest.class)
    public void verifySetup(){
        sketch.setup(NO_ARGS);
        
        PowerMockito.verifyStatic();
        Gpio.wiringPiSetup();
        
        verify(mocked_gpioController).provisionDigitalInputPin(RaspiPin.GPIO_00);
        verify(mocked_gpioController).provisionDigitalOutputPin(RaspiPin.GPIO_01);
        verifyNoMoreInteractions(mocked_gpioController);
    }    
    
    @Test
    @Category(SlowTest.class)
    public void testReadingShockSensor() throws InterruptedException{        
        when(mocked_gpioController.provisionDigitalInputPin(RaspiPin.GPIO_00)).thenReturn(mocked_shockPin);
        when(mocked_gpioController.provisionDigitalOutputPin(RaspiPin.GPIO_01)).thenReturn(mocked_ledPin);
        when(mocked_shockPin.isLow()).thenReturn(Boolean.TRUE);
        
        sketch.setup(NO_ARGS);
        sketch.setSketchInterruption();

        sketch.loop();
