Fix tests for APutOp and casting.

Bolstered tests for different aput-* scenarios
and fixed class-casting issue around Primatives
not being handled correctly.