[Attempt 5] The problem was with getContext. When the test is run along with others, somewhere a MockContext was slipping in. Fixed it by adding context.clearContext().