Skip to content

Commit

Permalink
'isOn()' added to 'SimpleLed'
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterHolz committed Jul 24, 2023
1 parent 593af02 commit cd8838f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/com/pi4j/catalog/components/SimpleLed.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public void on() {
digitalOutput.on();
}

public boolean isOn(){
return digitalOutput.isOn();
}

/**
* Sets the LED to off
*/
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/com/pi4j/catalog/components/SimpleLedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.pi4j.catalog.ComponentTest;
import com.pi4j.catalog.components.base.PIN;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.*;

public class SimpleLedTest extends ComponentTest {

Expand All @@ -34,6 +34,7 @@ public void testOn() {

//then
assertEquals(DigitalState.HIGH, digitalOutput.state());
assertTrue(led.isOn());
}

@Test
Expand All @@ -43,6 +44,7 @@ public void testOff() {

//then
assertEquals(DigitalState.LOW, digitalOutput.state());
assertFalse(led.isOn());
}


Expand Down

0 comments on commit cd8838f

Please sign in to comment.