Skip to content
Permalink
Browse files

add bsae test file for AbstractMessage derived classes; re-write Abst…

…ractMessageTest to use this.
  • Loading branch information...
pabender committed Sep 10, 2018
1 parent 288f0f5 commit 90134a7dc2bde2cb3014e071697aee7698fbb79f
Showing with 42 additions and 11 deletions.
  1. +7 −11 java/test/jmri/jmrix/AbstractMessageTest.java
  2. +35 −0 java/test/jmri/jmrix/AbstractMessageTestBase.java
@@ -10,27 +10,23 @@
*
* @author Paul Bender Copyright (C) 2017
*/
public class AbstractMessageTest {
public class AbstractMessageTest extends AbstractMessageTestBase {

@Test
public void testCTor() {
AbstractMessage t = new AbstractMessage(5){
// The minimal setup for log4J
@Before
public void setUp() {
JUnitUtil.setUp();
m = new AbstractMessage(5){
@Override
public String toString(){
return "";
}
};
Assert.assertNotNull("exists",t);
}

// The minimal setup for log4J
@Before
public void setUp() {
JUnitUtil.setUp();
}

@After
public void tearDown() {
m = null;
JUnitUtil.tearDown();
}

@@ -0,0 +1,35 @@
package jmri.jmrix;

import jmri.util.JUnitUtil;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
* Base tests for messages implementing the jmri.jmrix.Message interface.
*
* @author Paul Bender Copyright (C) 2017
*/
abstract public class AbstractMessageTestBase {

protected AbstractMessage m = null; // set in setUp

@Before
abstract public void setUp();

@Test
public void testCTor() {
Assert.assertNotNull("exists",m);
}

@Test
public void testToString() {
Assert.assertNotNull("toString has result",m.toString());
}

@Test
public void testToMonitorString() {
Assert.assertNotNull("toMonitorString has result",m.toMonitorString());
}

}

0 comments on commit 90134a7

Please sign in to comment.
You can’t perform that action at this time.