• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / jmockit1 / 496

15 Nov 2025 05:33PM UTC coverage: 72.192% (-0.008%) from 72.2%
496

push

github

web-flow
Merge pull request #412 from hazendaz/renovate/major-spring-core

Update spring core to v7 (major)

5677 of 8360 branches covered (67.91%)

Branch coverage included in aggregate %.

11922 of 16018 relevant lines covered (74.43%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.0
/main/src/main/java/mockit/internal/expectations/argumentMatching/ReflectiveMatcher.java
1
/*
2
 * MIT License
3
 * Copyright (c) 2006-2025 JMockit developers
4
 * See LICENSE file for full license text.
5
 */
6
package mockit.internal.expectations.argumentMatching;
7

8
import edu.umd.cs.findbugs.annotations.NonNull;
9
import edu.umd.cs.findbugs.annotations.Nullable;
10

11
import java.lang.reflect.Method;
12

13
import mockit.Delegate;
14
import mockit.internal.reflection.MethodReflection;
15

16
public final class ReflectiveMatcher implements ArgumentMatcher<ReflectiveMatcher> {
17
    @NonNull
18
    private final Delegate<?> delegate;
19
    @Nullable
20
    private Method handlerMethod;
21
    @Nullable
22
    private Object matchedValue;
23

24
    public ReflectiveMatcher(@NonNull Delegate<?> delegate) {
1✔
25
        this.delegate = delegate;
1✔
26
    }
1✔
27

28
    @Override
29
    public boolean same(@NonNull ReflectiveMatcher other) {
30
        return delegate == other.delegate;
1✔
31
    }
32

33
    @Override
34
    public boolean matches(@Nullable Object argValue) {
35
        if (handlerMethod == null) {
1✔
36
            handlerMethod = MethodReflection.findNonPrivateHandlerMethod(delegate);
1✔
37
        }
38

39
        matchedValue = argValue;
1✔
40
        Boolean result = MethodReflection.invoke(delegate, handlerMethod, argValue);
1✔
41

42
        return result == null || result;
1!
43
    }
44

45
    @Override
46
    public void writeMismatchPhrase(@NonNull ArgumentMismatch argumentMismatch) {
47
        if (handlerMethod != null) {
1!
48
            argumentMismatch.append(handlerMethod.getName()).append('(');
1✔
49
            argumentMismatch.appendFormatted(matchedValue);
1✔
50
            argumentMismatch.append(") (should return true, was false)");
1✔
51
        } else {
52
            argumentMismatch.append('?');
×
53
        }
54
    }
1✔
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc