Skip to content

Commit

Permalink
addressing pr comment
Browse files Browse the repository at this point in the history
Signed-off-by: Atanas Atanasov <[email protected]>
  • Loading branch information
ata-nas committed Nov 12, 2024
1 parent c93e3c1 commit 93c2c06
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public record MediatorConfig(
* @throws IllegalArgumentException if the configuration is invalid
*/
public MediatorConfig {
Preconditions.requirePositive(ringBufferSize, "Mediator Ring Buffer Size must be positive!");
Preconditions.requirePowerOfTwo(ringBufferSize, "Mediator Ring Buffer Size must be a power of 2!");
Preconditions.requirePositive(ringBufferSize, "Mediator Ring Buffer Size must be positive");
Preconditions.requirePowerOfTwo(ringBufferSize, "Mediator Ring Buffer Size must be a power of 2");
LOGGER.log(INFO, "Mediator configuration mediator.ringBufferSize: " + ringBufferSize);
LOGGER.log(INFO, "Mediator configuration mediator.type: " + type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public record NotifierConfig(@ConfigProperty(defaultValue = "1024") int ringBuff
* @throws IllegalArgumentException if the configuration is invalid
*/
public NotifierConfig {
Preconditions.requirePositive(ringBufferSize, "Notifier Ring Buffer Size must be positive!");
Preconditions.requirePowerOfTwo(ringBufferSize, "Notifier Ring Buffer Size must be a power of 2!");
Preconditions.requirePositive(ringBufferSize, "Notifier Ring Buffer Size must be positive");
Preconditions.requirePowerOfTwo(ringBufferSize, "Notifier Ring Buffer Size must be a power of 2");
LOGGER.log(INFO, "Notifier configuration notifier.ringBufferSize: " + ringBufferSize);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testMediatorConfig_happyPath() {
public void testMediatorConfig_negativeRingBufferSize() {
IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class, () -> new MediatorConfig(-1, ""));
assertEquals("Mediator Ring Buffer Size must be positive!", exception.getMessage());
assertEquals("Mediator Ring Buffer Size must be positive", exception.getMessage());
}

@Test
Expand All @@ -52,7 +52,7 @@ public void testMediatorConfig_powerOf2Values() {
for (int powerOf2Value : powerOf2Values) {
IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class, () -> new MediatorConfig(powerOf2Value + 1, ""));
assertEquals("Mediator Ring Buffer Size must be a power of 2!", exception.getMessage());
assertEquals("Mediator Ring Buffer Size must be a power of 2", exception.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void testNotifierConfig_happyPath() {
@Test
public void testNotifierConfig_negativeRingBufferSize() {
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> new NotifierConfig(-1));
assertEquals("Notifier Ring Buffer Size must be positive!", exception.getMessage());
assertEquals("Notifier Ring Buffer Size must be positive", exception.getMessage());
}

@Test
Expand All @@ -50,7 +50,7 @@ public void testMediatorConfig_powerOf2Values() {
for (int powerOf2Value : powerOf2Values) {
IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class, () -> new NotifierConfig(powerOf2Value + 1));
assertEquals("Notifier Ring Buffer Size must be a power of 2!", exception.getMessage());
assertEquals("Notifier Ring Buffer Size must be a power of 2", exception.getMessage());
}
}
}

0 comments on commit 93c2c06

Please sign in to comment.