ImmutableAcknowledgementLabel implements AcknowledgementLabel { static ImmutableAcknowledgementLabel of(final CharSequence label) { return new ImmutableAcknowledgementLabel(label.toString()); } private  ImmutableAcknowledgementLabel(final String label); @Override int length(); @Override char charAt(final int index); @Override CharSequence subSequence(final int start, final int end); @SuppressWarnings("squid:S2097") @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void compareToWorksAsExpected() { final ImmutableAcknowledgementLabel ackLabelAbc = ImmutableAcknowledgementLabel.of("abc"); final ImmutableAcknowledgementLabel ackLabelDef = ImmutableAcknowledgementLabel.of("def"); try (final AutoCloseableSoftAssertions softly = new AutoCloseableSoftAssertions()) { softly.assertThat(ackLabelAbc.compareTo(ackLabelAbc)) .as("compare with equal") .isZero(); softly.assertThat(ackLabelAbc.compareTo(ackLabelDef)) .as("compare with greater") .isNegative(); softly.assertThat(ackLabelDef.compareTo(ackLabelAbc)) .as("compare with less") .isPositive(); } }