Skip to content

Commit

Permalink
Split up to test the LoggingTool also with debugging turned on; so fa…
Browse files Browse the repository at this point in the history
…r, only with debugging turned of was tested

Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Sep 20, 2011
1 parent f5f9d23 commit 58bb243
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 208 deletions.
4 changes: 3 additions & 1 deletion src/test/org/openscience/cdk/modulesuites/Mlog4jTests.java
Expand Up @@ -23,6 +23,7 @@
import org.junit.runners.Suite.SuiteClasses;
import org.openscience.cdk.coverage.Log4jCoverageTest;
import org.openscience.cdk.tools.LoggingToolTest;
import org.openscience.cdk.tools.LoggingToolTestDebugTrue;

/**
* TestSuite that runs the tests for the CDK log4j module.
Expand All @@ -34,6 +35,7 @@
@RunWith(value=Suite.class)
@SuiteClasses(value={
Log4jCoverageTest.class,
LoggingToolTest.class
LoggingToolTest.class,
LoggingToolTestDebugTrue.class
})
public class Mlog4jTests {}
220 changes: 220 additions & 0 deletions src/test/org/openscience/cdk/tools/AbstractLoggingToolTest.java
@@ -0,0 +1,220 @@
/* Copyright (C) 2005-2009 Egon Willighagen <egonw@users.sf.net>
* 2007 Rajarshi Guha <rajarshi@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.openscience.cdk.tools;

import org.junit.Assert;
import org.junit.Test;
import org.openscience.cdk.CDKTestCase;

/**
* @cdk.module test-log4j
*/
public abstract class AbstractLoggingToolTest extends CDKTestCase {

public abstract LoggingTool getLoggingTool();

@Test public void testLoggingTool_Object() throws Exception {
LoggingTool logger = getLoggingTool();
Assert.assertNotNull(logger);
}

@Test public void testDebug_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, this);
}

@Test public void testDebug_Object_int() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, 1);
}

@Test public void testDebug_Object_double() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, 1.0);
}

@Test public void testDebug_Object_boolean() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, true);
}

@Test public void testDebug_Object_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, this, this, this, this);
}

@Test public void testDebug_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, this, this, this);
}

@Test public void testDebug_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.debug(this, this, this);
}

@Test public void testError_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this);
}

@Test public void testError_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, this);
}

@Test public void testError_Object_int() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, 1);
}

@Test public void testError_Object_double() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, 1.0);
}

@Test public void testError_Object_boolean() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, true);
}

@Test public void testError_Object_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, this, this, this, this);
}

@Test public void testError_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, this, this, this);
}

@Test public void testError_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.error(this, this, this);
}

@Test public void testWarn_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this);
}

@Test public void testWarn_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, this);
}

@Test public void testWarn_Object_int() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, 1);
}

@Test public void testWarn_Object_double() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, 1.0);
}

@Test public void testWarn_Object_boolean() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, true);
}

@Test public void testWarn_Object_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, this, this, this, this);
}

@Test public void testWarn_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, this, this, this);
}

@Test public void testWarn_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.warn(this, this, this);
}

@Test public void testInfo_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this);
}

@Test public void testInfo_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, this);
}

@Test public void testInfo_Object_int() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, 1);
}

@Test public void testInfo_Object_double() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, 1.0);
}

@Test public void testInfo_Object_boolean() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, true);
}

@Test public void testInfo_Object_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, this, this, this, this);
}

@Test
public void testInfo_Object_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, this, this, this);
}

@Test public void testInfo_Object_Object_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.info(this, this, this);
}

@Test public void testFatal_Object() throws Exception {
LoggingTool logger = getLoggingTool();
logger.fatal(this);
}

@Test public void testSetStackLength_int() throws Exception {
LoggingTool logger = getLoggingTool();
logger.setStackLength(20);
}

@Test public void testDumpClasspath() throws Exception {
LoggingTool logger = getLoggingTool();
logger.dumpClasspath();
}

@Test public void testDumpSystemProperties() throws Exception {
LoggingTool logger = getLoggingTool();
logger.dumpSystemProperties();
}

@Test public void testIsDebugEnabled() throws Exception {
LoggingTool logger = getLoggingTool();
logger.isDebugEnabled();
}

}

0 comments on commit 58bb243

Please sign in to comment.