SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
1.2 KiB

package de.superx.util;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Test;
public class TrashMapTest {
private static String KEY = "MAN_DEFAULT_REPORT";
/**
* @author Witt
* this test tests the 'TrashMap' class, which is a child of 'HashMap', that writes manipulations of the entry defined in 'KEY' to the log;
* originally written for error analysis of the 'sx_repository' server cache in 'SxPool'
*/
@Test
public void testTrashMapLog() {
Logger logger = Logger.getLogger(TrashMap.class);
logger.setAdditivity(false);
logger.removeAllAppenders();
UnittestAppender ta = new UnittestAppender();
logger.addAppender(ta);
Map ht = new HashMap();
ht.put("hallo", "welt");
TrashMap tm = new TrashMap(ht);
tm.put("bla", "blub");
tm.put(KEY, "INTERN");
tm.put(KEY, "INTERN");
tm.put(KEY, "INTERN1");
tm.clear();
tm.put(KEY, null);
tm.remove(KEY);
tm.clear();
Assert.assertEquals("unexpected count of log events", 10, ta.loggingEventList.size());
}
}