• 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

33.33
/main/src/main/java/mockit/internal/reflection/AnnotationReflection.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.reflection;
7

8
import static mockit.internal.reflection.ParameterReflection.NO_PARAMETERS;
9

10
import edu.umd.cs.findbugs.annotations.NonNull;
11
import edu.umd.cs.findbugs.annotations.Nullable;
12

13
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.Method;
15

16
public final class AnnotationReflection {
17
    private AnnotationReflection() {
18
    }
19

20
    @NonNull
21
    public static String readAnnotationAttribute(@NonNull Object annotationInstance, @NonNull String attributeName) {
22
        try {
23
            return readAttribute(annotationInstance, attributeName);
1✔
24
        } catch (NoSuchMethodException e) {
×
25
            throw new RuntimeException(e);
×
26
        }
27
    }
28

29
    @Nullable
30
    public static String readAnnotationAttributeIfAvailable(@NonNull Object annotationInstance,
31
            @NonNull String attributeName) {
32
        try {
33
            return readAttribute(annotationInstance, attributeName);
1✔
34
        } catch (NoSuchMethodException e) {
×
35
            return null;
×
36
        }
37
    }
38

39
    @NonNull
40
    private static String readAttribute(@NonNull Object annotationInstance, @NonNull String attributeName)
41
            throws NoSuchMethodException {
42
        try {
43
            Method publicMethod = annotationInstance.getClass().getMethod(attributeName, NO_PARAMETERS);
1✔
44
            return (String) publicMethod.invoke(annotationInstance);
1✔
45
        } catch (IllegalAccessException | InvocationTargetException e) {
×
46
            throw new RuntimeException(e instanceof InvocationTargetException ? e.getCause() : e);
×
47
        }
48
    }
49
}
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