Test exception and assertion