Skip to content

Commit

Permalink
Revert "rely upon inherited test code" account java does not allow de…
Browse files Browse the repository at this point in the history
…fault for methods in AbstractPowerManagerTestBase

This reverts commit 9edc447.
  • Loading branch information
devel-bobm committed Sep 30, 2018
1 parent 9edc447 commit 450cbf3
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 0 deletions.
15 changes: 15 additions & 0 deletions java/test/jmri/jmrix/easydcc/EasyDccPowerManagerTest.java
Expand Up @@ -37,6 +37,16 @@ protected void sendOffReply() {
protected void hearOff() {
// this does nothing, as there is no unsolicited on
}

@Override
protected void sendIdleReply() {
// this does nothign as there is no IDLE support
}

@Override
protected void hearIdle() {
// this does nothign as there is no IDLE support
}

@Override
protected int numListeners() {
Expand All @@ -58,6 +68,11 @@ protected boolean outboundOffOK(int index) {
return 'K' == ((controller.outbound.elementAt(index))).getOpCode();
}

@Override
protected boolean outboundIdleOK(int index) {
return false;
}

// setup a default EasyDccTrafficController interface
@Override
@Before
Expand Down
16 changes: 16 additions & 0 deletions java/test/jmri/jmrix/jmriclient/JMRIClientPowerManagerTest.java
Expand Up @@ -37,6 +37,17 @@ protected void sendOffReply() {
protected void hearOff() {
stc.sendTestReply(new JMRIClientReply("POWER OFF\n\r"));
}

@Override
protected void sendIdleReply() {
stc.sendTestReply(new JMRIClientReply("POWER IDLE\n\r"));
}

@Override
protected void hearIdle() {
stc.sendTestReply(new JMRIClientReply("POWER IDLE\n\r"));
}

@Override
protected int numListeners() {
return stc.numListeners();
Expand All @@ -57,6 +68,11 @@ protected boolean outboundOffOK(int index) {
return ((stc.outbound.elementAt(index))).toString().equals("POWER OFF\n");
}

@Override
protected boolean outboundIdleOK(int index) {
return ((stc.outbound.elementAt(index))).toString().equals("POWER IDLE\n");
}

// The minimal setup for log4J
@Before
@Override
Expand Down
15 changes: 15 additions & 0 deletions java/test/jmri/jmrix/lenz/XNetPowerManagerTest.java
Expand Up @@ -45,11 +45,21 @@ protected void sendOffReply() {
pm.message(m);
}

@Override
protected void sendIdleReply() {
return;
}

@Override
protected void hearOff() {
sendOffReply();
}

@Override
protected void hearIdle() {
return;
}

@Override
protected int numListeners() {
return tc.numListeners();
Expand All @@ -72,6 +82,11 @@ protected boolean outboundOffOK(int index) {
return tc.outbound.elementAt(index).equals(m);
}

@Override
protected boolean outboundIdleOK(int index) {
return true;
}

@Test
public void testGetUserName() {
Assert.assertEquals("User Name", "XpressNet", pm.getUserName());
Expand Down
16 changes: 16 additions & 0 deletions java/test/jmri/jmrix/nce/NcePowerManagerTest.java
Expand Up @@ -34,6 +34,17 @@ protected void hearOff() {
// this does nothing, as there is no unsolicited on
}

@Override
protected void sendIdleReply() {
NceReply l = new NceReply(controller);
controller.sendTestReply(l);
}

@Override
protected void hearIdle() {
// this does nothing, as there is no unsolicited on
}

@Override
protected int numListeners() {
return controller.numListeners();
Expand All @@ -54,6 +65,11 @@ protected boolean outboundOffOK(int index) {
return controller.outbound.elementAt(index).isKillMain();
}

@Override
protected boolean outboundIdleOK(int index) {
return controller.outbound.elementAt(index).isKillMain();
}

// setup a default NceTrafficController interface
@Before
@Override
Expand Down
16 changes: 16 additions & 0 deletions java/test/jmri/jmrix/sprog/SprogPowerManagerTest.java
Expand Up @@ -36,6 +36,17 @@ protected void sendOffReply() {
protected void hearOff() {
stc.sendTestReply(new SprogReply("-"));
}

@Override
protected void sendIdleReply() {
return;
}

@Override
protected void hearIdle() {
return;
}

@Override
protected int numListeners() {
return stc.numListeners();
Expand All @@ -56,6 +67,11 @@ protected boolean outboundOffOK(int index) {
return ((stc.outbound.elementAt(index))).toString().equals("-");
}

@Override
protected boolean outboundIdleOK(int index) {
return true;
}

@Test
@Override
@Ignore("unsolicited state changes are currently ignored")
Expand Down
15 changes: 15 additions & 0 deletions java/test/jmri/jmrix/srcp/SRCPPowerManagerTest.java
Expand Up @@ -39,6 +39,16 @@ protected void hearOff() {
stc.sendTestReply(new SRCPReply("12345678910 100 INFO 1 POWER OFF hello world\n\r"));
}

@Override
protected void sendIdleReply() {
return;
}

@Override
protected void hearIdle() {
return;
}

@Override
protected int numListeners() {
return stc.numListeners();
Expand All @@ -59,6 +69,11 @@ protected boolean outboundOffOK(int index) {
return ((stc.outbound.elementAt(index))).toString().equals("SET 1 POWER OFF\n");
}

@Override
protected boolean outboundIdleOK(int index) {
return ((stc.outbound.elementAt(index))).toString().equals("SET 1 POWER OFF\n");
}

@Test
@Override
@Ignore("unsolicited state changes are currently ignored")
Expand Down
14 changes: 14 additions & 0 deletions java/test/jmri/jmrix/xpa/XpaPowerManagerTest.java
Expand Up @@ -33,6 +33,15 @@ protected void sendOffReply() {
protected void hearOff() {
}

@Override
protected void sendIdleReply() {
((XpaPowerManager) p).reply(new XpaMessage("ATDT0;"));
}

@Override
protected void hearIdle() {
}

@Override
protected int numListeners() {
return tc.numListeners();
Expand All @@ -53,6 +62,11 @@ protected boolean outboundOffOK(int index) {
return ((tc.outbound.get(index))).toString().equals("ATDT0;");
}

@Override
protected boolean outboundIdleOK(int index) {
return ((tc.outbound.get(index))).toString().equals("ATDT0;");
}

@Test
@Override
@Ignore("unsolicited state changes are currently ignored")
Expand Down

0 comments on commit 450cbf3

Please sign in to comment.