use Modern::Perl;
-use Test::More tests => 5;
+use Test::More tests => 6;
use Test::MockObject;
use Test::Exception;
'Exception is thrown :-D';
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' );
};
+
+subtest 'Koha::Exceptions::Object::NotInstantiated tests' => sub {
+
+ plan tests => 4;
+
+ throws_ok
+ { Koha::Exceptions::Object::NotInstantiated->throw(
+ method => 'brain_explode', class => 'Koha::JD' ); }
+ 'Koha::Exceptions::Object::NotInstantiated',
+ 'Exception is thrown :-D';
+
+ # stringify the exception
+ is( "$@", 'Tried to access the \'brain_explode\' method, but Koha::JD is not instantiated', 'Exception stringified correctly' );
+
+ throws_ok
+ { Koha::Exceptions::Object::NotInstantiated->throw( "Manual message exception" ) }
+ 'Koha::Exceptions::Object::NotInstantiated',
+ 'Exception is thrown :-D';
+ is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' );
+};