Add new utility class then move some useful methods

TestUtils class is new utility class. Some methods are moved
from DuplicateUtil class. some of them are refined more generic.

Then some tests are fixed to use new one.