Skip to content

Commit

Permalink
set the conditions correctly so we can see what message is produced
Browse files Browse the repository at this point in the history
  • Loading branch information
pabender committed Feb 18, 2020
1 parent 9fd063c commit 59af691
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions java/test/jmri/jmris/simpleserver/SimpleLightServerTest.java
@@ -1,5 +1,6 @@
package jmri.jmris.simpleserver;

import jmri.Light;
import jmri.util.JUnitUtil;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -108,13 +109,14 @@ public void testParseOnStatus() {
// test parsing an OFF status message.
@Test
public void testParseOffStatus() {
Light light = (jmri.InstanceManager.getDefault(jmri.LightManager.class)).provideLight("IL1");
light.setState(Light.ON); // make sure the light is on before we parse the message.
SimpleLightServer a = (SimpleLightServer)ls;
Throwable thrown = catchThrowable( () -> a.parseStatus("LIGHT IL1 OFF\n"));
assertThat(thrown).withFailMessage("Exception retrieving Status").isNull();
jmri.Light light = (jmri.InstanceManager.getDefault(jmri.LightManager.class)).getLight("IL1");
assertThat(light.getState()).isEqualTo(jmri.Light.OFF).withFailMessage("Parse OFF Status Check");
// parsing the status also causes a message to return to the client.
//assertThat(sb.toString()).isEqualTo("LIGHT IL1 OFF\n").withFailMessage("parse OFF Status check");
assertThat(sb.toString()).isEqualTo("LIGHT IL1 OFF\n").withFailMessage("parse OFF Status check");
}

// test parsing an UNKNOWN status message.
Expand Down

0 comments on commit 59af691

Please sign in to comment.