Refactored by method extraction in tests

Signed-off-by: Rachel Logie <rachel.logie1@gmail.com>