Used setup to avoid repetition

Added a setup block to initialize an object to use in the test case. This setup eliminates repetition.