AbstractInternalLoggerTest Class — netty Architecture
Architecture documentation for the AbstractInternalLoggerTest class in AbstractInternalLoggerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8bfbe3cd_c7ba_49a7_5421_c778539d9290["AbstractInternalLoggerTest"] e563faf6_ebaa_bd28_02e3_dd89745a4a33["AbstractInternalLoggerTest.java"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|defined in| e563faf6_ebaa_bd28_02e3_dd89745a4a33 a328f03b_5f8f_67fd_c4c0_c24a31a89b60["V()"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|method| a328f03b_5f8f_67fd_c4c0_c24a31a89b60 267c3170_76be_00fe_96db_5130850b52ad["testName()"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|method| 267c3170_76be_00fe_96db_5130850b52ad 5ba4729d_e805_472e_0ef4_536490977458["testAllLevel()"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|method| 5ba4729d_e805_472e_0ef4_536490977458 de8867f1_e475_be07_c6a7_3a7ee88ddae0["testLevel()"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|method| de8867f1_e475_be07_c6a7_3a7ee88ddae0 3bf6799d_4535_4891_88be_d81e4aa0da02["assertResult()"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|method| 3bf6799d_4535_4891_88be_d81e4aa0da02 ffe7a3ca_bc67_f9dd_7c28_f87b08803a6f["setLevelEnable()"] 8bfbe3cd_c7ba_49a7_5421_c778539d9290 -->|method| ffe7a3ca_bc67_f9dd_7c28_f87b08803a6f
Relationship Graph
Source Code
common/src/test/java/io/netty/util/internal/logging/AbstractInternalLoggerTest.java lines 31–150
public abstract class AbstractInternalLoggerTest<T> {
protected String loggerName = "foo";
protected T mockLog;
protected InternalLogger logger;
protected final Map<String, Object> result = new HashMap<String, Object>();
@SuppressWarnings("unchecked")
protected <V> V getResult(String key) {
return (V) result.get(key);
}
@Test
public void testName() {
assertEquals(loggerName, logger.name());
}
@Test
public void testAllLevel() throws Exception {
testLevel(InternalLogLevel.TRACE);
testLevel(InternalLogLevel.DEBUG);
testLevel(InternalLogLevel.INFO);
testLevel(InternalLogLevel.WARN);
testLevel(InternalLogLevel.ERROR);
}
protected void testLevel(InternalLogLevel level) throws Exception {
result.clear();
String format1 = "a={}", format2 = "a={}, b= {}", format3 = "a={}, b= {}, c= {}";
String msg = "a test message from Junit";
Exception ex = new Exception("a test Exception from Junit");
Class<InternalLogger> clazz = InternalLogger.class;
String levelName = level.name(), logMethod = levelName.toLowerCase();
Method isXXEnabled = clazz
.getMethod("is" + levelName.charAt(0) + levelName.substring(1).toLowerCase() + "Enabled");
// when level log is disabled
setLevelEnable(level, false);
assertFalse((Boolean) isXXEnabled.invoke(logger));
// test xx(msg)
clazz.getMethod(logMethod, String.class).invoke(logger, msg);
assertTrue(result.isEmpty());
// test xx(format, arg)
clazz.getMethod(logMethod, String.class, Object.class).invoke(logger, format1, msg);
assertTrue(result.isEmpty());
// test xx(format, argA, argB)
clazz.getMethod(logMethod, String.class, Object.class, Object.class).invoke(logger, format2, msg, msg);
assertTrue(result.isEmpty());
// test xx(format, ...arguments)
clazz.getMethod(logMethod, String.class, Object[].class).invoke(logger, format3,
new Object[] { msg, msg, msg });
assertTrue(result.isEmpty());
// test xx(format, ...arguments), the last argument is Throwable
clazz.getMethod(logMethod, String.class, Object[].class).invoke(logger, format3,
new Object[] { msg, msg, msg, ex });
assertTrue(result.isEmpty());
// test xx(msg, Throwable)
clazz.getMethod(logMethod, String.class, Throwable.class).invoke(logger, msg, ex);
assertTrue(result.isEmpty());
// test xx(Throwable)
clazz.getMethod(logMethod, Throwable.class).invoke(logger, ex);
assertTrue(result.isEmpty());
// when level log is enabled
setLevelEnable(level, true);
assertTrue((Boolean) isXXEnabled.invoke(logger));
// test xx(msg)
result.clear();
clazz.getMethod(logMethod, String.class).invoke(logger, msg);
assertResult(level, null, null, msg);
// test xx(format, arg)
Source
Frequently Asked Questions
What is the AbstractInternalLoggerTest class?
AbstractInternalLoggerTest is a class in the netty codebase, defined in common/src/test/java/io/netty/util/internal/logging/AbstractInternalLoggerTest.java.
Where is AbstractInternalLoggerTest defined?
AbstractInternalLoggerTest is defined in common/src/test/java/io/netty/util/internal/logging/AbstractInternalLoggerTest.java at line 31.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free