This test class is driving me crazy. I have can prove an array is passing through the class from the test class, but I can't seem to get code coverage. I did use the Json2Apex tool to build the class. Any tips comments would be appreciated.
public class JSON2Apex {
public Integer facilityId;
public String facilityName;
public Integer orderId;
public Integer calculated_Event_Price;
public Double tax;
public Integer subTotal;
public Double orderTotal;
public Integer tip;
public Double totalWithTip;
public Double totalPayments;
public Integer totalRefunds;
public Integer balanceDue;
public String reportFilterStartDate;
public String reportFilterEndDate;
public static List<JSON2Apex> parse(String json) {
return (List<JSON2Apex>) System.JSON.deserialize(json, List<JSON2Apex>.class);
}
}
Test Class:
@IsTest
public class JSON2Apex_Test {
static testMethod void testParse() {
String json = '['+
' {'+
' \"facilityId\": 15779,'+
' \"facilityName\": \"Urban Air - Conway, AB\",'+
' \"orderId\": 71989998,'+
' \"calculated_Event_Price\": 275,'+
' \"tax\": 27.48,'+
' \"subTotal\": 314,'+
' \"orderTotal\": 341.48,'+
' \"tip\": 0,'+
' \"totalWithTip\": 341.48,'+
' \"totalPayments\": 341.48,'+
' \"totalRefunds\": 0,'+
' \"balanceDue\": 0,'+
' \"reportFilterStartDate\": \"2018-01-01T00:00:00\",'+
' \"reportFilterEndDate\": \"2018-01-02T00:00:00\"'+
' },'+
' {'+
' \"facilityId\": 1559,'+
' \"facilityName\": \"Urban Air - Conway, AR\",'+
' \"orderId\": 71989998,'+
' \"calculated_Event_Price\": 275,'+
' \"tax\": 27.48,'+
' \"subTotal\": 314,'+
' \"orderTotal\": 341.48,'+
' \"tip\": 0,'+
' \"totalWithTip\": 341.48,'+
' \"totalPayments\": 341.48,'+
' \"totalRefunds\": 0,'+
' \"balanceDue\": 0,'+
' \"reportFilterStartDate\": \"2018-01-01T00:00:00\",'+
' \"reportFilterEndDate\": \"2018-01-02T00:00:00\"'+
' }'+
']';
List<JSON2Apex> obj1 = JSON2Apex.parse(json);
System.assert(obj1 != null);
}
}