ttt
ttt

Reputation: 4004

Google Guava Predicates.or() or Predicates.and() type

In Guava, there is a utilities kind of method for Predicates class called 'or' or 'and', you can either pass a iterable or two predicates.

I have a code example like below:

class AccountNamePredicate implements Predicate<Account> {}
class AccountTypePredicate implements Predicate<Account> {}
class AccountManager {
    public Predicate<Account> getPredicate() {
         return Predicates.and(new AccountNamePredicate(), new AccountTypePredicate());
    }
}

My question is for the method getPredicate in AccountManager class, how can I test the method?

If I want to assert the return type of this method, how can I write the correct code. My assert statement below doesn't pass:

assertThat(getPredicate(), is(instanceOf(Predicate.class)));

Any idea about that?

Upvotes: 1

Views: 1426

Answers (1)

Alex Rios
Alex Rios

Reputation: 21

There is nothing to test in your scenario. If you insist on test that you're testing the guava framework (guava development team already do that well) not your application.

Upvotes: 2

Related Questions