8 sub Fake::new { bless({}, 'Fake') }
9 sub Fake::foo { push @call, a => $_[1] }
10 sub Fake::bar { push @call, c => $_[1] }
13 local $JSON::MaybeXS::JSON_Class = 'Fake';
15 my @args = (foo => 'b', bar => 'd');
17 foreach my $args (\@args, [ { @args } ]) {
21 my $obj = JSON::MaybeXS->new(@$args);
23 is(ref($obj), 'Fake', 'Object of correct class');
25 is(join(' ', sort @call), 'a b c d', 'Methods called');