With randomization, primaries may not reflect changes, so check total instead
Added Java tests