my $duck = src::bo::Duck->new(); is( ref($duck), "src::bo::Duck", "A duck object" ); throws_ok { $duck->setFlyBehaviour( src::bo::CannotFly->new() ) } qr/setFlyBehaviour is protected/, "setFlyBehaviour is protected"; throws_ok { $duck->( "FLYBEHAVIOUR", src::bo::CannotFly->new() ) } qr/FLYBEHAVIOUR is protected/, "FLYBEHAVIOUR is protected"; #is( $duck->doFly(), "cannot fly", "the duck cannot fly" ); my $rubber = src::bo::Rubber->new(); is( ref($rubber), "src::bo::Rubber", "A rubber duck object" ); is( $rubber->doFly(), "cannot fly", "the rubber duck cannot fly" ); is( $rubber->doQuack(), "can sqeek", "the rubber duck sqeeks" ); my $whistle = src::bo::Whistle->new(); is( ref($whistle), "src::bo::Whistle", "A whistle object" ); is( $whistle->doFly(), "cannot fly", "the whistle doesn't fly" ); is( $whistle->doQuack(), "cannot quack", "the whistle doesn't quack" ); throws_ok { $whistle->setQuackBehaviour( src::bo::CanQuack->new() ) } qr/setQuackBehaviour is protected/, "setQuackBehaviour is protected"; throws_ok { $whistle->( "QUACKBEHAVIOUR", src::bo::CanQuack->new() ) } qr/QUACKBEHAVIOUR is protected/, "QUACKBEHAVIOUR is protected"; $rubber->setColor("green"); is( $rubber->getColor(), "green", "it's a green rubber duck!" );