PolicyLoggerTestpublic class PolicyLoggerTest extends TestCase
Fields Summary |
---|
private PolicyLogger | instance |
Constructors Summary |
---|
public PolicyLoggerTest(String testName)
super(testName);
|
Methods Summary |
---|
protected void | setUp()
instance = PolicyLogger.getLogger(PolicyLoggerTest.class);
| protected void | tearDown()
| public void | testCommonsCreateAndLogException()Test of createAndLogException method, of class com.sun.xml.ws.policy.privateutil.PolicyUtils.Commons.
PolicyLogger logger = PolicyLogger.getLogger(PolicyLoggerTest.class);
Throwable cause, result;
String message;
cause = new Exception();
message = "Test message.";
result = logger.logSevereException(new IllegalArgumentException(message), cause);
assertEquals(message, result.getMessage());
assertEquals(cause, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
message = "Test message.";
result = logger.logSevereException(new NullPointerException(message), cause);
assertEquals(message, result.getMessage());
assertEquals(cause, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
message = null;
result = logger.logSevereException(new PolicyException(message), true);
assertEquals(message, result.getMessage());
assertEquals(null, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
message = "Test message.";
result = logger.logSevereException(new PolicyException(message), false);
assertEquals(message, result.getMessage());
assertEquals(null, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
cause = new NullPointerException("test");
message = null;
result = logger.logSevereException(new PolicyException(message, cause), true);
assertEquals(message, result.getMessage());
assertEquals(cause, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
cause = new NullPointerException("test");
message = "Test message.";
result = logger.logSevereException(new PolicyException(message, cause), false);
assertEquals(message, result.getMessage());
assertEquals(cause, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
message = null;
result = logger.logSevereException(new PolicyException(message));
assertEquals(message, result.getMessage());
assertEquals(null, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
message = "Test message.";
result = logger.logSevereException(new PolicyException(message));
assertEquals(message, result.getMessage());
assertEquals(null, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
cause = new NullPointerException("test");
message = null;
result = logger.logSevereException(new PolicyException(message, cause));
assertEquals(message, result.getMessage());
assertEquals(cause, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
cause = new NullPointerException("test");
message = "Test message.";
result = logger.logSevereException(new PolicyException(message, cause));
assertEquals(message, result.getMessage());
assertEquals(cause, result.getCause());
assertEquals("testCommonsCreateAndLogException", result.getStackTrace()[0].getMethodName());
| public void | testConfig()Test of config method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.config(message);
| public void | testEntering()Test of entering method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
instance.entering();
| public void | testExiting()Test of exiting method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
instance.exiting();
| public void | testFine()Test of fine method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.fine(message);
| public void | testFiner()Test of finer method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.finer(message);
| public void | testFinest()Test of finest method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.finest(message);
| public void | testGetLogger()Test of getLogger method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
PolicyLogger result = PolicyLogger.getLogger(PolicyLoggerTest.class);
assertNotNull(result);
try {
PolicyLogger.getLogger(null);
fail("NullPointerException expected");
} catch (NullPointerException e) { /* ok */ }
| public void | testInfo()Test of info method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.info(message);
| public void | testIsLoggable()Test of isLoggable method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
boolean expResult, result;
instance.setLevel(Level.ALL);
expResult = true;
result = instance.isLoggable(Level.FINEST);
assertEquals(expResult, result);
result = instance.isLoggable(Level.FINER);
assertEquals(expResult, result);
result = instance.isLoggable(Level.FINE);
assertEquals(expResult, result);
result = instance.isLoggable(Level.CONFIG);
assertEquals(expResult, result);
result = instance.isLoggable(Level.INFO);
assertEquals(expResult, result);
result = instance.isLoggable(Level.WARNING);
assertEquals(expResult, result);
result = instance.isLoggable(Level.SEVERE);
assertEquals(expResult, result);
result = instance.isLoggable(Level.ALL);
assertEquals(expResult, result);
instance.setLevel(Level.OFF);
expResult = false;
result = instance.isLoggable(Level.FINEST);
assertEquals(expResult, result);
result = instance.isLoggable(Level.FINER);
assertEquals(expResult, result);
result = instance.isLoggable(Level.FINE);
assertEquals(expResult, result);
result = instance.isLoggable(Level.CONFIG);
assertEquals(expResult, result);
result = instance.isLoggable(Level.INFO);
assertEquals(expResult, result);
result = instance.isLoggable(Level.WARNING);
assertEquals(expResult, result);
result = instance.isLoggable(Level.SEVERE);
assertEquals(expResult, result);
result = instance.isLoggable(Level.ALL);
assertEquals(expResult, result);
| public void | testIsMethodCallLoggable()Test of isMethodCallLoggable method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
boolean expResult = true;
instance.setLevel(Level.FINEST);
boolean result = instance.isMethodCallLoggable();
assertEquals(expResult, result);
expResult = false;
instance.setLevel(Level.FINER);
result = instance.isMethodCallLoggable();
assertEquals(expResult, result);
| public void | testLog()Test of log method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
Level level = Level.FINEST;
String message = "Test";
instance.log(level, message);
| public void | testSetLevel()Test of setLevel method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
instance.setLevel(Level.FINE);
assertFalse(instance.isLoggable(Level.FINER));
assertTrue(instance.isLoggable(Level.INFO));
| public void | testSevere()Test of severe method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.severe(message);
| public void | testWarning()Test of warning method, of class com.sun.xml.ws.policy.privateutil.PolicyLogger.
String message = "Test";
instance.warning(message);
|
|