Testing of advertisement.

Had to break out some methods to be able to test them.