Skip to content
Permalink
Browse files

better handling of warning in tests

  • Loading branch information...
bobjacobsen committed Sep 22, 2018
1 parent c852cbc commit ea0d4ab71a9a2e3b81583023a7d530bc183c0130
@@ -325,6 +325,8 @@ public void propertyChange(PropertyChangeEvent e) {
@Deprecated // will be removed when Manager method is removed due to @Override
public String[] getSystemNameArray() {
jmri.util.Log4JUtil.warnOnce(log, "Manager#getSystemNameArray() is deprecated");
if (log.isTraceEnabled()) log.trace("Manager#getSystemNameArray() called", new Exception("traceback"));

if (cachedSystemNameArray == null) {
cachedSystemNameArray = getSystemNameList().toArray(new String[_beans.size()]);
}
@@ -467,6 +467,8 @@ public int getObjectCount() {
@Deprecated // will be removed when Manager method is removed due to @Override
public String[] getSystemNameArray() {
jmri.util.Log4JUtil.warnOnce(log, "Manager#getSystemNameArray() is deprecated");
if (log.isTraceEnabled()) log.trace("Manager#getSystemNameArray() called", new Exception("traceback"));

List<E> list = getNamedBeanList();
String[] retval = new String[list.size()];
int i = 0;
@@ -91,6 +91,7 @@ public void testDelete() {
Assert.assertEquals(0, l.getSystemNameAddedOrderList().size());
Assert.assertEquals(0, l.getSystemNameList().size());
Assert.assertEquals(0, l.getSystemNameArray().length);
jmri.util.JUnitAppender.suppressWarnMessage("Manager#getSystemNameArray() is deprecated");
Assert.assertEquals(0, l.getObjectCount());
}

@@ -333,6 +333,7 @@ public void testOrderVsSorted() {
List<Sensor> beanList = l.getNamedBeanList();
SortedSet<Sensor> beanSet = l.getNamedBeanSet();
String[] sortedArray = l.getSystemNameArray();
jmri.util.JUnitAppender.suppressWarnMessage("Manager#getSystemNameArray() is deprecated");
List<String> orderedList = l.getSystemNameAddedOrderList();

Assert.assertEquals("sorted list length", 2, sortedList.size());
@@ -391,6 +392,7 @@ public void testOrderVsSorted() {
beanList = l.getNamedBeanList();
beanSet = l.getNamedBeanSet();
sortedArray = l.getSystemNameArray();
jmri.util.JUnitAppender.suppressWarnMessage("Manager#getSystemNameArray() is deprecated");

Assert.assertEquals("ordered list length", 4, orderedList.size());
Assert.assertEquals("ordered list 1st", "IS4", orderedList.get(0));

0 comments on commit ea0d4ab

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