use of com.microsoft.azure.sdk.iot.device.CustomLogger in project azure-iot-sdk-java by Azure.
the class CustomLoggerTest method testLogWarn.
// Tests_SRS_CUSTOMERLOGGER_25_002: [The function shall print message for WARN level.]
@Test
public void testLogWarn(@Mocked final Logger mockLogger) {
final String message = "This is WARN message";
new NonStrictExpectations() {
{
Logger.getLogger((Class) any);
result = mockLogger;
mockLogger.isEnabledFor(Level.WARN);
result = true;
}
};
new CustomLogger(this.getClass()).LogWarn(message);
new Verifications() {
{
mockLogger.warn(anyString);
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.device.CustomLogger in project azure-iot-sdk-java by Azure.
the class CustomLoggerTest method testLogFatal.
// Tests_SRS_CUSTOMERLOGGER_25_002: [The function shall print message for FATAL level.]
@Test
public void testLogFatal(@Mocked final Logger mockLogger) {
final String message = "This is FATAL message";
new NonStrictExpectations() {
{
Logger.getLogger((Class) any);
result = mockLogger;
mockLogger.isEnabledFor(Level.FATAL);
result = true;
}
};
new CustomLogger(this.getClass()).LogFatal(message);
new Verifications() {
{
mockLogger.fatal(anyString);
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.device.CustomLogger in project azure-iot-sdk-java by Azure.
the class CustomLoggerTest method getExecutingMethodName.
// Tests_SRS_CUSTOMERLOGGER_25_002: [The function shall log message for all levels.]
@Test
public void getExecutingMethodName() {
CustomLogger logger = new CustomLogger(this.getClass());
String methodName = logger.getMethodName();
assertThat("getExecutingMethodName", is(equalTo(methodName)));
}
use of com.microsoft.azure.sdk.iot.device.CustomLogger in project azure-iot-sdk-java by Azure.
the class CustomLoggerTest method testMethodSignature.
// Tests_SRS_CUSTOMERLOGGER_25_002: [The function shall log message for all levels.]
@Test
public void testMethodSignature() {
CustomLogger logger = new CustomLogger(this.getClass());
String message = "This is INFO message";
logger.LogInfo(message, logger.getMethodName());
message = "This is DEBUG message";
logger.LogDebug(message, logger.getMethodName());
message = "This is TRACE message";
logger.LogTrace(message, logger.getMethodName());
message = "This is WARN message";
logger.LogWarn(message, logger.getMethodName());
message = "This is FATAL message";
logger.LogFatal(message, logger.getMethodName());
message = "This is CUSTOM ERROR message";
logger.LogError(message, logger.getMethodName());
message = "This is ERROR message";
logger.LogError(new Throwable(message));
}
Aggregations