File tree Expand file tree Collapse file tree
main/java/io/prometheus/client
test/java/io/prometheus/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ public double observeDuration() {
166166 * {@link SimpleCollector#remove} or {@link SimpleCollector#clear}.
167167 */
168168 public static class Child {
169- private static class Value {
169+ public static class Value {
170170 public final double count ;
171171 public final double sum ;
172172 public final SortedMap <Double , Double > quantiles ;
Original file line number Diff line number Diff line change 22
33import static org .junit .Assert .assertArrayEquals ;
44import static org .junit .Assert .assertEquals ;
5+ import static org .junit .Assert .assertTrue ;
56
7+ import java .lang .reflect .Method ;
8+ import java .lang .reflect .Modifier ;
69import java .util .ArrayList ;
710import java .util .List ;
811import org .junit .After ;
@@ -180,4 +183,17 @@ public void testCollect() {
180183 assertEquals (mfsFixture , mfs .get (0 ));
181184 }
182185
186+ @ Test
187+ public void testChildAndValuePublicApi () throws Exception {
188+ assertTrue (Modifier .isPublic (Histogram .Child .class .getModifiers ()));
189+
190+ final Method getMethod = Histogram .Child .class .getMethod ("get" );
191+ assertTrue (Modifier .isPublic (getMethod .getModifiers ()));
192+ assertEquals (Histogram .Child .Value .class , getMethod .getReturnType ());
193+
194+ assertTrue (Modifier .isPublic (Histogram .Child .Value .class .getModifiers ()));
195+ assertTrue (Modifier .isPublic (Histogram .Child .Value .class .getField ("sum" ).getModifiers ()));
196+ assertTrue (Modifier .isPublic (Histogram .Child .Value .class .getField ("buckets" ).getModifiers ()));
197+ }
198+
183199}
Original file line number Diff line number Diff line change 44import org .junit .Before ;
55import org .junit .Test ;
66
7+ import java .lang .reflect .Method ;
8+ import java .lang .reflect .Modifier ;
79import java .util .ArrayList ;
810import java .util .List ;
911
1012import static java .util .Arrays .asList ;
1113import static org .junit .Assert .assertEquals ;
14+ import static org .junit .Assert .assertTrue ;
1215
1316
1417public class SummaryTest {
@@ -180,4 +183,18 @@ public void testCollectWithQuantiles() {
180183 assertEquals (1 , mfs .size ());
181184 assertEquals (mfsFixture , mfs .get (0 ));
182185 }
186+
187+ @ Test
188+ public void testChildAndValuePublicApi () throws Exception {
189+ assertTrue (Modifier .isPublic (Summary .Child .class .getModifiers ()));
190+
191+ final Method getMethod = Summary .Child .class .getMethod ("get" );
192+ assertTrue (Modifier .isPublic (getMethod .getModifiers ()));
193+ assertEquals (Summary .Child .Value .class , getMethod .getReturnType ());
194+
195+ assertTrue (Modifier .isPublic (Summary .Child .Value .class .getModifiers ()));
196+ assertTrue (Modifier .isPublic (Summary .Child .Value .class .getField ("count" ).getModifiers ()));
197+ assertTrue (Modifier .isPublic (Summary .Child .Value .class .getField ("sum" ).getModifiers ()));
198+ assertTrue (Modifier .isPublic (Summary .Child .Value .class .getField ("quantiles" ).getModifiers ()));
199+ }
183200}
You can’t perform that action at this time.
0 commit comments