I am having some trouble getting any code coverage from my Test class. I noticed on the forum that there seemed to be an issue in regards to inner classes, which led me to a similar issue below:
However, I am using an inner abstract class and with that abstract class, extending it and creating a concrete class. Once I run my test, it gives me Zero % code coverage. Needless to say, this is quite an agitating issue.
Diagnostic Code
public with sharing class DiagnosticsInstrumentation
{
public abstract class BaseDiagnostics
{
private Boolean DiagnosticsEnabled;
private List DiagnosticLog;
public abstract void Push(String FunctionName);
public abstract void Pop();
public abstract void PopAll();
public abstract void DiagnoseException(Exception DiagnosedException);
private abstract String CurrentLog();
private abstract void Diagnose(String DaignosticStatement);
private abstract Boolean IsEnabled();
public BaseDiagnostics()
{
this.DiagnosticsEnabled = this.IsEnabled();
this.DiagnosticLog = new List();
}
}
public class DiagnosticEntry
{
//...
public DiagnosticEntry(String EntryDescription, Integer LevelNumber)
{
//...
}
}
public class BasicDiagnostics extends BaseDiagnostics
{
public override void Push(String FunctionName)
{
//...
}
public override void Pop()
{
//...
}
public override void PopAll()
{
//...
}
public override void DiagnoseException(Exception DiagnosedException)
{
//...
}
private override String CurrentLog()
{
//...
return null;
}
private override void Diagnose(String DiagnosticStatement)
{
//...
}
private override Boolean IsEnabled()
{
return true;
}
}
}
The Diagnostic Code's Test Class
Note: In the test I added the static part but, if you add or remove it it makes no difference.
@isTest
public with sharing class BasicDiagnostics_Tests
{
static
{
new DiagnosticsInstrumentation();
}
public static TestMethod void Test_BasicDiagnostics_Functionality()
{
DiagnosticsInstrumentation.BaseDiagnostics TestDiagnosticTool = new DiagnosticsInstrumentation.BasicDiagnostics();
TestDiagnosticTool.Push('Testing One Input');
TestDiagnosticTool.Pop();
TestDiagnosticTool.Push('Testing Two Input');
TestDiagnosticTool.Push('Testing Three Input');
TestDiagnosticTool.Push('Testing Four Input');
TestDiagnosticTool.PopAll();
Account NullAccount = new Account();
try
{
INSERT NullAccount;
}
catch(DmlException Caught)
{
TestDiagnosticTool.DiagnoseException(Caught);
TestDiagnosticTool.PopAll();
}
}
}
I thank anyone in advance for your help on this issue.