I an trying to write a testclass for a JSON object but het the error:
Illegal assignment from List to or_guestsJSON. How do I annotate the list in my testclass?
Class
public class or_guestsJSON {
public String lastLogin;
public String lastName;
public String zipCode;
public String linkedinURL;
public String city;
public static List<or_guestsJSON> parse(String json) {
return (List<or_guestsJSON>) System.JSON.deserialize(json, List<or_guestsJSON>.class);
}
}
Test
@isTest
public class or_guestsJSONTest {
static testMethod void guestsTest() {
String json= '[{'+
' "lastLogin": "2018-05-20 10:33:41.0",'+
' "lastName": "GuestLast",'+
' "zipCode": "00000",'+
' "linkedinURL": "www.linkedin.com/guestprofile",'+
' "city": "California",'+
'}]';
or_guestsJSON obj = or_guestsJSON.parse(json);
System.assert(obj != null);
}
}