1. Project Clover database Wed Nov 12 2025 05:07:35 UTC
  2. Package guru.mikelue.foxglove.annotation

File GenData.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
86% of files have more coverage

Code metrics

0
1
2
2
103
26
2
2
0.5
1
1

Classes

Class Line # Actions
GenData 33 0 - 0 0
-1.0 -
GenData.FallbackDataGeneratorProvider 91 1 0% 2 3
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package guru.mikelue.foxglove.annotation;
2   
3    import java.lang.annotation.*;
4    import java.util.function.Supplier;
5   
6    import guru.mikelue.foxglove.DataGenerator;
7    import guru.mikelue.foxglove.TableFacet;
8    import guru.mikelue.foxglove.functional.DataGeneratorProvider;
9    import guru.mikelue.foxglove.functional.TableFacetProvider;
10    import guru.mikelue.foxglove.functional.TableFacetsProvider;
11   
12    /**
13    * Annotation to define data generation configuration for a test method.
14    *
15    * {@link guru.mikelue.foxglove.annotation package doc} detail the semantics
16    * if none of the {@link #facetsNames()} or {@link #facets()} is defined by client code.
17    *
18    * <hr>
19    *
20    * <h2>How should a processing engine resolve names</h2>
21    *
22    * <ol>
23    * <li>Looking for {@link TableFacetsSource#value()} or {@link DataGeneratorSource#value()}.</li>
24    * <li>Using the name of method/field.</li>
25    * </ol>
26    *
27    * @see TableFacetProvider
28    * @see DataGeneratorProvider
29    */
30    @Target({ElementType.METHOD, ElementType.TYPE})
31    @Retention(RetentionPolicy.RUNTIME)
32    @Documented @Inherited
 
33    public @interface GenData {
34    /**
35    * Defines the a builder(as a {@link Supplier}) of {@link TableFacet} for generating rules of tables.
36    *
37    * This property has higher priority than {@link #facets()}.
38    *
39    * @return The classes of providers for table facets
40    *
41    * @see #facetsNames()
42    */
43    Class<? extends TableFacetsProvider<? extends TableFacet>>[] value() default {};
44   
45    /**
46    * Defines the a builder(as a {@link Supplier}) of {@link TableFacet} for generating rules of tables.
47    *
48    * This property has higher priority than {@link #facetsNames()}.
49    *
50    * @return The classes of providers for table facets
51    *
52    * @see #value()
53    */
54    Class<? extends TableFacetsProvider<? extends TableFacet>>[] facets() default {};
55    /**
56    * Defines the name of {@link TableFacet} for generating rules of tables.
57    *
58    * The resolving of names is dependent on {@link TableFacetsSource} and the implementation of processing engine.
59    *
60    * @return The names of table facets
61    */
62    String[] facetsNames() default {};
63    /**
64    * Defines the data generator(as a {@link Supplier}).
65    *
66    * <p>
67    * Only one of {@link #generatorName()} or this property should be defined.
68    *
69    * @return The class of provider for data generator
70    */
71    Class<? extends DataGeneratorProvider<? extends TableFacet>> generator() default FallbackDataGeneratorProvider.class;
72    /**
73    * Defines the name of data generator(as a {@link Supplier}).
74    *
75    * <p>
76    * Only one of {@link #generator()} or this property should be defined.
77    *
78    * The resolving of names is dependent on {@link DataGeneratorSource} and the implementation of processing engine.
79    *
80    * @return The name of data generator
81    */
82    String generatorName() default "";
83   
84    /**
85    * Fallback provider of data generator,
86    * this provider will throw {@link UnsupportedOperationException} while being invoked.
87    *
88    * <p>
89    * The processing engine of test framework should ignore this provider if a default one is figured out.
90    */
 
91    class FallbackDataGeneratorProvider implements DataGeneratorProvider<TableFacet> {
 
92  0 toggle FallbackDataGeneratorProvider() {}
93   
94    /**
95    * {@inheritDoc}
96    */
 
97  0 toggle @Override
98    public DataGenerator<TableFacet> get()
99    {
100  0 throw new UnsupportedOperationException("No default data generator is provided");
101    }
102    }
103    }