1
0

Add missing '@Override' annotations.

This commit is contained in:
Gary Gregory
2020-11-21 13:56:50 -05:00
parent cd99c4164f
commit 02ac584cd9
45 changed files with 267 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ public class AltHashtable extends Hashtable {
public static Object lastKey;
public static Object lastValue;
@Override
public Object put(final Object key, final Object value) {
lastKey = key;
lastValue = value;

View File

@@ -53,6 +53,7 @@ public class AltHashtableTestCase extends TestCase {
* This is true of all JVMs I know of; and if it isn't then this test will
* fail and someone will tell us.
*/
@Override
public void setUp() {
System.setProperty(
"org.apache.commons.logging.LogFactory.HashtableImpl",

View File

@@ -81,6 +81,7 @@ public class LoadTestCase extends TestCase{
// not very trivial to emulate we must implement "findClass",
// but it will delegete to junit class loder first
@Override
public Class loadClass(final String name)throws ClassNotFoundException{
//isolates all logging classes, application in the same classloader too.
@@ -211,11 +212,13 @@ public class LoadTestCase extends TestCase{
}
@Override
public void setUp() {
// save state before test starts so we can restore it when test ends
origContextClassLoader = Thread.currentThread().getContextClassLoader();
}
@Override
public void tearDown() {
// restore original state so a test can't stuff up later tests.
Thread.currentThread().setContextClassLoader(origContextClassLoader);

View File

@@ -20,6 +20,7 @@ package org.apache.commons.logging;
public class LogTestCase extends AbstractLogTest
{
@Override
public Log getLogObject()
{
/**

View File

@@ -101,6 +101,7 @@ public class PathableClassLoader extends URLClassLoader {
* use addLogicalLib instead, then define the location for that logical
* library in the build.xml file.
*/
@Override
public void addURL(final URL url) {
super.addURL(url);
}
@@ -291,6 +292,7 @@ public class PathableClassLoader extends URLClassLoader {
* prefix associated with that entry then attempt to load the class via
* that entries' classloader.
*/
@Override
protected Class loadClass(final String name, final boolean resolve)
throws ClassNotFoundException {
// just for performance, check java and javax
@@ -340,6 +342,7 @@ public class PathableClassLoader extends URLClassLoader {
* the resource is looked for in the local classpath before the parent
* loader is consulted.
*/
@Override
public URL getResource(final String name) {
if (parentFirst) {
return super.getResource(name);
@@ -413,6 +416,7 @@ public class PathableClassLoader extends URLClassLoader {
* the resource is looked for in the local classpath before the parent
* loader is consulted.
*/
@Override
public InputStream getResourceAsStream(final String name) {
if (parentFirst) {
return super.getResourceAsStream(name);

View File

@@ -133,6 +133,7 @@ public class PathableTestSuite extends TestSuite {
* The context classloader and system properties are saved before each
* test, and restored after the test completes to better isolate tests.
*/
@Override
public void runTest(final Test test, final TestResult result) {
final ClassLoader origContext = Thread.currentThread().getContextClassLoader();
final Properties oldSysProps = (Properties) System.getProperties().clone();

View File

@@ -20,6 +20,7 @@ import org.apache.commons.logging.impl.SimpleLog;
public class SimpleLogTestCase extends AbstractLogTest
{
@Override
public Log getLogObject()
{
return new SimpleLog(this.getClass().getName());

View File

@@ -36,6 +36,7 @@ public class AvalonLoggerTestCase extends AbstractLogTest {
return suite;
}
@Override
public Log getLogObject() {
// Output does not seem to be used, so don't display it.
final Log log = new AvalonLogger(new NullLogger());

View File

@@ -87,6 +87,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -94,6 +95,7 @@ public class FirstPriorityConfigTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}

View File

@@ -105,6 +105,7 @@ public class PriorityConfigTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -112,6 +113,7 @@ public class PriorityConfigTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}

View File

@@ -53,6 +53,7 @@ public class WeakHashtableTestCase extends TestCase {
super(testName);
}
@Override
protected void setUp() throws Exception {
super.setUp();
weakHashtable = new WeakHashtable();
@@ -273,6 +274,7 @@ public class WeakHashtableTestCase extends TestCase {
super(name);
}
@Override
public void run() {
for (int i = 0; i < RUN_LOOPS; i++) {
hashtable.put("key" + ":" + i%10, Boolean.TRUE);

View File

@@ -165,6 +165,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
setUpManager
("org/apache/commons/logging/jdk14/CustomConfig.properties");
@@ -200,6 +201,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
super.tearDown();
handlers = null;
@@ -259,6 +261,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
// Test Serializability of Log instance
@Override
public void testSerializable() throws Exception {
super.testSerializable();
@@ -271,6 +274,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
// Check the log instance
@Override
protected void checkLog() {
assertNotNull("Log exists", log);

View File

@@ -78,6 +78,7 @@ public class DefaultConfigTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
setUpFactory();
setUpLog("TestLogger");
@@ -100,6 +101,7 @@ public class DefaultConfigTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
log = null;
factory = null;

View File

@@ -53,15 +53,18 @@ public class TestHandler extends Handler {
// -------------------------------------------------------- Handler Methods
@Override
public void close() {
}
@Override
public void flush() {
records.clear();
}
@Override
public void publish(final LogRecord record) {
records.add(record);
}

View File

@@ -58,6 +58,7 @@ public abstract class StandardTests extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -65,6 +66,7 @@ public abstract class StandardTests extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}

View File

@@ -32,6 +32,7 @@ import org.apache.log4j.Logger;
public class Log4j12StandardTests extends StandardTests {
@Override
public void setUpTestAppender(final List logEvents) {
final TestAppender appender = new TestAppender(logEvents);
final Logger rootLogger = Logger.getRootLogger();

View File

@@ -49,6 +49,7 @@ public class TestAppender extends AppenderSkeleton {
// ------------------------------------------------------- Appender Methods
@Override
protected void append(final LoggingEvent event) {
final StandardTests.LogEvent lev = new StandardTests.LogEvent();
@@ -70,10 +71,12 @@ public class TestAppender extends AppenderSkeleton {
}
@Override
public void close() {
}
@Override
public boolean requiresLayout() {
return false;
}

View File

@@ -76,6 +76,7 @@ public class StandardTestCase extends AbstractLogTest {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
@@ -90,6 +91,7 @@ public class StandardTestCase extends AbstractLogTest {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
log = null;
factory = null;
@@ -102,6 +104,7 @@ public class StandardTestCase extends AbstractLogTest {
* Override the abstract method from the parent class so that the
* inherited tests can access the right Log object type.
*/
@Override
public Log getLogObject()
{
return new LogKitLogger(this.getClass().getName());

View File

@@ -37,6 +37,7 @@ public class NoOpLogTestCase extends AbstractLogTest
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
@@ -48,6 +49,7 @@ public class NoOpLogTestCase extends AbstractLogTest
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
System.getProperties().remove("org.apache.commons.logging.Log");
@@ -57,6 +59,7 @@ public class NoOpLogTestCase extends AbstractLogTest
* Override the abstract method from the parent class so that the
* inherited tests can access the right Log object type.
*/
@Override
public Log getLogObject()
{
return new NoOpLog(this.getClass().getName());

View File

@@ -58,6 +58,7 @@ public class MockSecurityManager extends SecurityManager {
return untrustedCodeCount;
}
@Override
public void checkPermission(final Permission p) throws SecurityException {
if (setSecurityManagerPerm.implies(p)) {
// ok, allow this; we don't want to block any calls to setSecurityManager

View File

@@ -69,11 +69,13 @@ public class SecurityAllowedTestCase extends TestCase
return new PathableTestSuite(testClass, parent);
}
@Override
public void setUp() {
// save security manager so it can be restored in tearDown
oldSecMgr = System.getSecurityManager();
}
@Override
public void tearDown() {
// Restore, so other tests don't get stuffed up if a test
// sets a custom security manager.

View File

@@ -73,6 +73,7 @@ public class SecurityForbiddenTestCase extends TestCase
return new PathableTestSuite(testClass, parent);
}
@Override
public void setUp() {
// save security manager so it can be restored in tearDown
oldSecMgr = System.getSecurityManager();
@@ -84,6 +85,7 @@ public class SecurityForbiddenTestCase extends TestCase
otherClassLoader = classLoader;
}
@Override
public void tearDown() {
// Restore, so other tests don't get stuffed up if a test
// sets a custom security manager.

View File

@@ -73,6 +73,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
* when they are created. Subclasses can override this method to
* define properties that suit them.
*/
@Override
public void setProperties() {
System.setProperty(
"org.apache.commons.logging.Log",
@@ -85,6 +86,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
setProperties();
@@ -121,6 +123,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
super.tearDown();
expected = null;
@@ -151,6 +154,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
// Test Serializability of standard instance
@Override
public void testSerializable() throws Exception {
((DecoratedSimpleLog) log).clearCache();
@@ -166,6 +170,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
// Check the decorated log instance
@Override
protected void checkDecorated() {
assertNotNull("Log exists", log);
@@ -224,6 +229,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
// Check the standard log instance
@Override
protected void checkStandard() {
checkDecorated();

View File

@@ -64,6 +64,7 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
* set up the props defined in the parent class setProperties method,
* and add a few to configure the SimpleLog class date/time output.
*/
@Override
public void setProperties() {
super.setProperties();
@@ -78,6 +79,7 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
super.setUp();
}
@@ -86,6 +88,7 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
// ----------------------------------------------------------- Methods
/** Checks that the date time format has been successfully set */
@Override
protected void checkDecoratedDateTime() {
assertEquals("Expected date format to be set", "dd.mm.yyyy",
((DecoratedSimpleLog) log).getDateTimeFormat());
@@ -98,6 +101,7 @@ public class DateTimeCustomConfigTestCase extends CustomConfigTestCase {
}
/** Hook for subclassses */
@Override
protected void checkShowDateTime() {
assertTrue(((DecoratedSimpleLog) log).getShowDateTime());
}

View File

@@ -76,6 +76,7 @@ public class DecoratedSimpleLog extends SimpleLog {
// Cache logged messages
@Override
protected void log(final int type, final Object message, final Throwable t) {
super.log(type, message, t);

View File

@@ -100,6 +100,7 @@ public class DefaultConfigTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
setProperties();
@@ -110,6 +111,7 @@ public class DefaultConfigTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
log = null;
factory = null;

View File

@@ -22,23 +22,41 @@ public class MyLog implements Log {
public MyLog(final String category) {}
@Override
public boolean isDebugEnabled() { return false; }
@Override
public boolean isErrorEnabled() { return false; }
@Override
public boolean isFatalEnabled() { return false; }
@Override
public boolean isInfoEnabled() { return false; }
@Override
public boolean isTraceEnabled() { return false; }
@Override
public boolean isWarnEnabled() { return false; }
@Override
public void trace(final Object message) {}
@Override
public void trace(final Object message, final Throwable t) {}
@Override
public void debug(final Object message) {}
@Override
public void debug(final Object message, final Throwable t) {}
@Override
public void info(final Object message) {}
@Override
public void info(final Object message, final Throwable t) {}
@Override
public void warn(final Object message) {}
@Override
public void warn(final Object message, final Throwable t) {}
@Override
public void error(final Object message) {}
@Override
public void error(final Object message, final Throwable t) {}
@Override
public void fatal(final Object message) {}
@Override
public void fatal(final Object message, final Throwable t) {}
}

View File

@@ -22,11 +22,18 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MyLogFactoryImpl extends LogFactory {
@Override
public Object getAttribute(final String name) { return null; }
@Override
public String[] getAttributeNames() { return null; }
@Override
public Log getInstance(final Class clazz) { return null; }
@Override
public Log getInstance(final String name) { return null; }
@Override
public void release() {}
@Override
public void removeAttribute(final String name) {}
@Override
public void setAttribute(final String name, final Object value) {}
}

View File

@@ -91,6 +91,7 @@ public class TcclDisabledTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -98,6 +99,7 @@ public class TcclDisabledTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}

View File

@@ -91,6 +91,7 @@ public class TcclEnabledTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -98,6 +99,7 @@ public class TcclEnabledTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}

View File

@@ -93,6 +93,7 @@ public class TcclDisabledTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -100,6 +101,7 @@ public class TcclDisabledTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}

View File

@@ -87,6 +87,7 @@ public class TcclEnabledTestCase extends TestCase {
/**
* Set up instance variables required by this test case.
*/
@Override
public void setUp() throws Exception {
LogFactory.releaseAll();
}
@@ -94,6 +95,7 @@ public class TcclEnabledTestCase extends TestCase {
/**
* Tear down instance variables required by this test case.
*/
@Override
public void tearDown() {
LogFactory.releaseAll();
}