View Javadoc
1   /*
2    * Copyright (c) 2006 JMockit developers
3    * This file is subject to the terms of the MIT license (see LICENSE.txt).
4    */
5   package mockit.internal.expectations.argumentMatching;
6   
7   import edu.umd.cs.findbugs.annotations.NonNull;
8   import edu.umd.cs.findbugs.annotations.Nullable;
9   
10  public final class NonNullityMatcher implements ArgumentMatcher<NonNullityMatcher> {
11      public static final ArgumentMatcher<?> INSTANCE = new NonNullityMatcher();
12  
13      private NonNullityMatcher() {
14      }
15  
16      @Override
17      public boolean same(@NonNull NonNullityMatcher other) {
18          return true;
19      }
20  
21      @Override
22      public boolean matches(@Nullable Object argValue) {
23          return argValue != null;
24      }
25  
26      @Override
27      public void writeMismatchPhrase(@NonNull ArgumentMismatch argumentMismatch) {
28          argumentMismatch.append("not null");
29      }
30  }