• 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.46
/main/src/main/java/mockit/internal/injection/InjectionProvider.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.injection;
7

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

11
import java.lang.annotation.Annotation;
12
import java.lang.reflect.Type;
13

14
/**
15
 * Provides type, name, and value(s) for an injection point, which is either a field to be injected or a parameter in
16
 * the chosen constructor of a tested class.
17
 */
18
public abstract class InjectionProvider {
19
    public static final Object NULL = Void.class;
1✔
20

21
    @NonNull
22
    protected final Type declaredType;
23
    @NonNull
24
    protected final String name;
25
    @Nullable
26
    public InjectionProvider parent;
27

28
    protected InjectionProvider(@NonNull Type declaredType, @NonNull String name) {
1✔
29
        this.declaredType = declaredType;
1✔
30
        this.name = name;
1✔
31
    }
1✔
32

33
    @NonNull
34
    public final Type getDeclaredType() {
35
        return declaredType;
1✔
36
    }
37

38
    @NonNull
39
    public abstract Class<?> getClassOfDeclaredType();
40

41
    @NonNull
42
    public final String getName() {
43
        return name;
1✔
44
    }
45

46
    @NonNull
47
    public Annotation[] getAnnotations() {
48
        throw new UnsupportedOperationException("No annotations");
×
49
    }
50

51
    @Nullable
52
    public Object getValue(@Nullable Object owner) {
53
        return null;
×
54
    }
55

56
    public boolean isRequired() {
57
        return false;
1✔
58
    }
59

60
    public boolean hasAnnotation(@NonNull Class<? extends Annotation> annotationOfInterest) {
61
        for (Annotation annotation : getAnnotations()) {
1✔
62
            if (annotationOfInterest.isInstance(annotation)) {
1!
63
                return true;
1✔
64
            }
65
        }
66

67
        return false;
1✔
68
    }
69

70
    @Override
71
    public String toString() {
72
        Class<?> type = getClassOfDeclaredType();
1✔
73
        StringBuilder description = new StringBuilder().append('"').append(type.getSimpleName()).append(' ')
1✔
74
                .append(name).append('"');
1✔
75

76
        if (parent != null) {
1✔
77
            description.append("\r\n  when initializing ").append(parent);
1✔
78
        }
79

80
        return description.toString();
1✔
81
    }
82
}
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