Use assertRaises() for negative tests

This patch makes negative tests use assertRaises() for cleaning up.

Change-Id: Ief64c0737f7aabc414744861e7c750ec2bb1e466