Adding test and fixing capture spy behavior for capturing a class type