AnyEvent-Stomper
view release on metacpan or search on metacpan
t/03-exceptions.t view on Meta::CPAN
use 5.008000;
use strict;
use warnings;
use Test::More tests => 15;
use Test::Fatal;
use AnyEvent::Stomper;
use AnyEvent::Stomper::Cluster;
t_heartbeat();
t_conn_timeout();
t_reconnect_interval();
t_on_message();
t_ack_message();
t_nodes();
sub t_heartbeat {
like(
exception {
my $stomper = AnyEvent::Stomper->new(
heartbeat => 'invalid',
);
},
qr/"heartbeat" must be specified as array reference/,
'invalid "heartbeat" (character string)'
);
like(
exception {
my $stomper = AnyEvent::Stomper->new(
heartbeat => [ 'invalid', 'invalid' ],
);
},
qr/"heartbeat" values must be an integer numbers/,
'invalid "heartbeat" values (character string)'
);
}
sub t_conn_timeout {
like(
exception {
my $stomper = AnyEvent::Stomper->new(
connection_timeout => 'invalid',
);
},
qr/"connection_timeout" must be a positive number/,
'invalid connection timeout (character string; constructor)'
);
like(
exception {
my $stomper = AnyEvent::Stomper->new(
connection_timeout => -5,
);
},
qr/"connection_timeout" must be a positive number/,
'invalid connection timeout (negative number; constructor)'
);
my $stomper = AnyEvent::Stomper->new();
like(
exception {
$stomper->connection_timeout('invalid');
},
qr/"connection_timeout" must be a positive number/,
( run in 1.231 second using v1.01-cache-2.11-cpan-54e63673c56 )