RedisBasedPersistenceServiceConstants { public static final String orderingKey(final int priorityLevel) { Preconditions.checkArgument(priorityLevel > 0, "Priority level must be a positive integer number"); return orderingKeyPrefix() + priorityLevel; }  static final String orderingKey(final int priorityLevel); static final String orderingKeyPrefix(); static final String ORDERING_KEY_PREFIX; }
@Test public void shouldThrowExceptionWhenOrderingKeyIsConstructedFromNegativeNumber() throws Exception { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Priority level must be a positive integer number"); RedisBasedPersistenceServiceConstants.orderingKey(-1); fail(); }
@Test public void shouldThrowExceptionWhenOrderingKeyIsConstructedFromZero() throws Exception { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Priority level must be a positive integer number"); RedisBasedPersistenceServiceConstants.orderingKey(0); fail(); }
@Test public void shouldCreateOrderingKeyPrefixFromPositiveNumber() throws Exception { int priorityLevel = 10; String expectedOrderingKey = EXPECTED_ORDERING_KEY_PREFIX + priorityLevel; String givenOrderingKey = RedisBasedPersistenceServiceConstants.orderingKey(priorityLevel); assertions.assertThat(givenOrderingKey).isEqualTo(expectedOrderingKey); }