From d97e9ce930c2b7563d861c3093e282903d98a1f0 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Sat, 24 Nov 2012 16:32:35 +0000 Subject: The argument to our class factories must be a non-nil string. --- t/test-custodian-alertfactory.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't/test-custodian-alertfactory.rb') diff --git a/t/test-custodian-alertfactory.rb b/t/test-custodian-alertfactory.rb index ede6aa7..4f2fb8d 100755 --- a/t/test-custodian-alertfactory.rb +++ b/t/test-custodian-alertfactory.rb @@ -51,6 +51,25 @@ class TestAlertFactory < Test::Unit::TestCase assert( obj.respond_to? "raise" ) assert( obj.respond_to? "clear" ) end + + + # + # Creating an alert we don't know about is an error + # + assert_raise ArgumentError do + obj = Custodian::AlertFactory.create( "not found", nil ) + end + + # + # A string is mandatory + # + assert_raise ArgumentError do + obj = Custodian::AlertFactory.create( nil, nil ) + end + assert_raise ArgumentError do + obj = Custodian::AlertFactory.create( Array.new, nil ) + end + end end -- cgit v1.2.1