I am trying to increase the code coverage for following below method using jmockit -
Below is my method in DataLogger
class for which I am trying to increase the coverage -
public void logDebug(final Object... objects) {
if (m_logger.isDebugEnabled() && objects != null) {
m_logger.debug(message(objects));
}
}
And below is my isDebugEnabled
-
public boolean isDebugEnabled() {
return m_logger.isDebugEnabled();
}
Somehow my cobertura coverage report is showing as Conditional Coverage 25% [1/4]
if I run my below test.
@Test
public void testLogDebug() {
DataLogger logger = DataLogger.getInstance(ClientTest.class);
logger.logDebug(this);
logger.logDebug();
new MockUp<DataLogger>() {
@Mock
public boolean isDebugEnabled() {
return true;
}
};
logger.logDebug(this);
new MockUp<DataLogger>() {
@Mock
public boolean isDebugEnabled() {
return false;
}
};
logger.logDebug(this);
logger.logDebug((Object) null);
}
Is there anything else I am supposed to do?