1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 22:32:07 +01:00

Add more tests for RevocationState

This commit is contained in:
Paul Schaub 2022-11-25 15:41:56 +01:00
parent ae6a427d90
commit 6913aa3d6d
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -72,6 +72,8 @@ public class RevocationStateTest {
Date now = new Date(); Date now = new Date();
assertEquals(RevocationState.softRevoked(now), RevocationState.softRevoked(now)); assertEquals(RevocationState.softRevoked(now), RevocationState.softRevoked(now));
assertEquals(1, RevocationState.softRevoked(now).compareTo(RevocationState.notRevoked()));
assertEquals(0, RevocationState.notRevoked().compareTo(RevocationState.notRevoked())); assertEquals(0, RevocationState.notRevoked().compareTo(RevocationState.notRevoked()));
assertEquals(0, RevocationState.hardRevoked().compareTo(RevocationState.hardRevoked())); assertEquals(0, RevocationState.hardRevoked().compareTo(RevocationState.hardRevoked()));
assertTrue(RevocationState.hardRevoked().compareTo(RevocationState.notRevoked()) > 0); assertTrue(RevocationState.hardRevoked().compareTo(RevocationState.notRevoked()) > 0);
@ -93,4 +95,15 @@ public class RevocationStateTest {
assertEquals(states, Arrays.asList(not, not2, laterSoft, earlySoft, hard)); assertEquals(states, Arrays.asList(not, not2, laterSoft, earlySoft, hard));
} }
@SuppressWarnings({"SimplifiableAssertion", "ConstantConditions", "EqualsWithItself", "EqualsBetweenInconvertibleTypes"})
@Test
public void equalsTest() {
RevocationState rev = RevocationState.hardRevoked();
assertFalse(rev.equals(null));
assertTrue(rev.equals(rev));
assertFalse(rev.equals("not a revocation"));
RevocationState other = RevocationState.notRevoked();
assertFalse(rev.equals(other));
}
} }