You need to sign in to do that
Don't have an account?

Bug with SeeAllData annotation in ver 24?
I am getting a null pointer exception when attempting to reference the Who.Type value on a Task when I set the SeeAllData annotation on my test class to “false”. The field is included in the column list of a Task query and while the WhoId has a value, the Who.Type field is null. Change it to “true” and the Who.Type field returned in the query has a value. Here are two log segments showing the result:
@isTest(SeeAllData=false)
SOQL_EXECUTE_BEGIN|[62]|Aggregations:0|select Id, WhoId, Who.Type, WhatId, What.Type from Task where Id IN :tmpVar1
SOQL_EXECUTE_END|[62]|Rows:1
USER_DEBUG|[79]|DEBUG|======>WhoId: 00Q8000000tGECZEA4
USER_DEBUG|[80]|DEBUG|======>Who.Type: null
@isTest(SeeAllData=true)
SOQL_EXECUTE_BEGIN|[62]|Aggregations:0|select Id, WhoId, Who.Type, WhatId, What.Type from Task where Id IN :tmpVar1
SOQL_EXECUTE_END|[62]|Rows:1
USER_DEBUG|[79]|DEBUG|======>WhoId: 00Q8000000tGE2uEAG
USER_DEBUG|[80]|DEBUG|======>Who.Type: Lead
I can’t see any reason that the polymorphic ID’s type would not be returned simply because the test class is configured not to see existing data other than this being a bug. Am I missing something? Anyone else seen anything like this?
I discovered that if you chnage the version number of the test class from 24 to 23, the problem goes away. Still seems like a bug but at least there is a work around if you need SeeAllData=false AND you don't need anything specific to version 24.