Move tests inside a single method and remove unused code

Some code cleanup to existing tests - FilterTest and PreviewTest. Moved tests inside a single method in both classes since the individual tests did not required separate testing environments.

Also, this PR removes some unused variables from code.