DittoAcknowledgementLabel implements AcknowledgementLabel { public static AcknowledgementLabel[] values() { return new AcknowledgementLabel[]{TWIN_PERSISTED, LIVE_RESPONSE}; } private  DittoAcknowledgementLabel(final CharSequence labelValue); static AcknowledgementLabel[] values(); static boolean contains(@Nullable final AcknowledgementLabel acknowledgementLabel); @SuppressWarnings("squid:S2097") @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override int length(); @Override char charAt(final int index); @Override CharSequence subSequence(final int start, final int end); @Override String toString(); static final DittoAcknowledgementLabel TWIN_PERSISTED; static final DittoAcknowledgementLabel LIVE_RESPONSE; }
@Test public void valuesReturnsAllConstantsInCorrectOrder() throws IllegalAccessException { final Collection<DittoAcknowledgementLabel> expectedConstants = new ArrayList<>(); final Class<DittoAcknowledgementLabel> underTestType = DittoAcknowledgementLabel.class; final Field[] declaredFields = underTestType.getDeclaredFields(); for (final Field declaredField : declaredFields) { if (isDittoAckLabelConstant(underTestType, declaredField)) { final Object constantValue = declaredField.get(null); expectedConstants.add((DittoAcknowledgementLabel) constantValue); } } final AcknowledgementLabel[] actual = DittoAcknowledgementLabel.values(); assertThat(actual).containsExactlyElementsOf(expectedConstants); }