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

File DataGenContext.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
1
1
1
103
19
1
1
1
1
1

Classes

Class Line # Actions
DataGenContext 24 1 0% 1 0
1.0100%
 

Contributing tests

This file is covered by 38 tests. .

Source view

1    package guru.mikelue.foxglove.annotation;
2   
3    import java.util.List;
4    import java.util.Optional;
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.TableFacetsProvider;
10   
11    /**
12    * Reflection information for named {@link TableFacetsSource} and {@link DataGeneratorSource} objects.
13    *
14    * <p>
15    * This interface is usually used by processing engine of test framework.
16    *
17    * <h2>Default methods</h2>
18    *
19    * For {@link #getDefaultTableFacets(Object)} and {@link #getDefaultDataGenerator(Object)},
20    * the tested instance must define only one {@link TableFacetsSource} or {@link DataGeneratorSource}.
21    *
22    * @param <T> The type of table facet
23    */
 
24    public interface DataGenContext<T extends TableFacet> {
25    /**
26    * Loads data generation context from given test class.
27    *
28    * @param testClass The test class to load from
29    * @param <T> The type of table facet
30    *
31    * @return The loaded data generation context
32    */
 
33  53 toggle static <T extends TableFacet> DataGenContext<T> loadFrom(Class<?> testClass)
34    {
35  53 return new DataGenContextImpl<>(testClass);
36    }
37   
38    /**
39    * Gets {@link TableFacet}s by provider class.
40    *
41    * @param clazz The type of table facets provider
42    * @param testingInstance The test instance to enclosing the provider class
43    *
44    * @return The initialized table facets
45    */
46    List<T> getTypedTableFacets(Class<? extends TableFacetsProvider<T>> clazz, Object testingInstance);
47   
48    /**
49    * Gets named table facets from given test instance.
50    *
51    * @param name The name of table facets
52    * @param testingInstance The test instance to grab from
53    *
54    * @return The grabbed table facets
55    */
56    List<T> getNamedTableFacets(String name, Object testingInstance);
57   
58    /**
59    * Gets {@link DataGenerator}s by provider class.
60    *
61    * @param clazz The type of provider of data generator
62    * @param testingInstance The test instance to enclosing the provider class
63    *
64    * @return The initialized data generator
65    */
66    DataGenerator<T> getTypedDataGenerator(Class<? extends DataGeneratorProvider<T>> clazz, Object testingInstance);
67   
68    /**
69    * Gets named data generator from given test instance.
70    *
71    * @param name The name of data generator
72    * @param testingInstance The test instance to grab from
73    *
74    * @return The grabbed data generator
75    */
76    DataGenerator<T> getNamedDataGenerator(String name, Object testingInstance);
77   
78    /**
79    * Gets default table facets from given test instance.
80    *
81    * <p>
82    * The tested instance must define only one {@link TableFacetsSource},
83    * otherwise exception is thrown.
84    *
85    * @param testingInstance The test instance to grab from
86    *
87    * @return The grabbed table facets
88    */
89    Optional<List<T>> getDefaultTableFacets(Object testingInstance);
90   
91    /**
92    * Gets default data generator from given test instance.
93    *
94    * <p>
95    * The tested instance must define only one {@link DataGeneratorSource},
96    * otherwise exception is thrown.
97    *
98    * @param testingInstance The test instance to grab from
99    *
100    * @return The grabbed data generator
101    */
102    Optional<DataGenerator<T>> getDefaultDataGenerator(Object testingInstance);
103    }