use warnings;
use Test::More;
-use Test::Fatal;
+use Test::Exception;
use Class::MOP;
}
);
- ::like (::exception(
+ ::throws_ok(
sub {
CheckingAccount->meta->add_before_method_modifier(
'does_not_exist' => sub { } );
- }),
+ },
qr/\QThe method 'does_not_exist' was not found in the inheritance hierarchy for CheckingAccount/
);
isa_ok( $savings_account, 'BankAccount' );
is( $savings_account->balance, 250, '... got the right savings balance' );
-ok ! exception {
+lives_ok {
$savings_account->withdraw(50);
-},
+}
'... withdrew from savings successfully';
is( $savings_account->balance, 200,
'... got the right savings balance after withdrawal' );
-ok exception {
+dies_ok {
$savings_account->withdraw(250);
-},
+}
'... could not withdraw from savings successfully';
$savings_account->deposit(150);
is( $checking_account->balance, 100, '... got the right checkings balance' );
-ok ! exception {
+lives_ok {
$checking_account->withdraw(50);
-},
+}
'... withdrew from checking successfully';
is( $checking_account->balance, 50,
'... got the right checkings balance after withdrawal' );
'... got the right savings balance after checking withdrawal (no overdraft)'
);
-ok ! exception {
+lives_ok {
$checking_account->withdraw(200);
-},
+}
'... withdrew from checking successfully';
is( $checking_account->balance, 0,
'... got the right checkings balance after withdrawal' );