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

leeonky / test-charm-java / 218

15 Apr 2025 02:45PM UTC coverage: 74.045% (-0.04%) from 74.088%
218

push

circleci

leeonky
Introduce adaptiveList

20 of 21 new or added lines in 3 files covered. (95.24%)

34 existing lines in 11 files now uncovered.

7968 of 10761 relevant lines covered (74.05%)

0.74 hits per line

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

95.45
/DAL-java/src/main/java/com/github/leeonky/dal/extensions/MetaProperties.java
1
package com.github.leeonky.dal.extensions;
2

3
import com.github.leeonky.dal.DAL;
4
import com.github.leeonky.dal.runtime.*;
5
import com.github.leeonky.util.BeanClass;
6
import com.github.leeonky.util.NoSuchAccessorException;
7
import com.github.leeonky.util.Sneaky;
8

9
import java.util.Set;
10

11
import static com.github.leeonky.dal.runtime.DalException.extractException;
12
import static com.github.leeonky.dal.runtime.Order.BUILD_IN;
13

14
@Order(BUILD_IN)
15
public class MetaProperties implements Extension {
1✔
16
    private static Object size(MetaData metaData) {
17
        return metaData.data().list().size();
1✔
18
    }
19

20
    private static Object throw_(MetaData metaData) {
21
        try {
22
            metaData.data().instance();
1✔
23
            throw new AssertionError("Expecting an error to be thrown, but nothing was thrown");
1✔
24
        } catch (Exception e) {
1✔
25
            return Sneaky.get(() -> extractException(e).orElseThrow(() -> e));
1✔
26
        }
27
    }
28

29
    private static Object object_(MetaData metaData) {
30
        return metaData.data().instance() == null ? null : new OriginalJavaObject(metaData.data());
1✔
31
    }
32

33
    private static Object keys(MetaData metaData) {
34
        return metaData.data().fieldNames();
1✔
35
    }
36

37
    @Override
38
    public void extend(DAL dal) {
39
        dal.getRuntimeContextBuilder()
1✔
40
                .registerMetaProperty("size", MetaProperties::size)
1✔
41
                .registerMetaProperty("throw", MetaProperties::throw_)
1✔
42
                .registerMetaProperty("object", MetaProperties::object_)
1✔
43
                .registerMetaProperty("keys", MetaProperties::keys)
1✔
44
        ;
45
    }
1✔
46

47
    static class OriginalJavaObject implements ProxyObject {
48
        private final Data data;
49

50
        public OriginalJavaObject(Data data) {
1✔
51
            this.data = data;
1✔
52
        }
1✔
53

54
        @Override
55
        public Object getValue(Object property) {
56
            try {
57
                Object instance = data.instance();
1✔
58
                return BeanClass.createFrom(instance).getPropertyValue(instance, property.toString());
1✔
59
            } catch (NoSuchAccessorException ignore) {
1✔
60
                return data.property(property).instance();
1✔
61
            }
62
        }
63

64
        @Override
65
        public Set<?> getPropertyNames() {
UNCOV
66
            return BeanClass.createFrom(data.instance()).getPropertyReaders().keySet();
×
67
        }
68
    }
69
}
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