Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancing Clarity with assume API in Precondition Checks for validatePropertyUpdates and validateApiWhenRemovingChild #713

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.spy;
Expand Down Expand Up @@ -76,9 +77,11 @@ public void validatePropertyUpdates() {
config.addConfig(Layers.APPLICATION, child);

// Validate initial state
assertEquals("propvalue", config.getProperty("propname").get());
assertEquals("propvalue", config.getRawProperty("propname"));

assumeTrue("propvalue".equals(config.getProperty("propname").orElse(null)),
"Property 'propname' does not have the expected value 'propvalue', test assumptions not met.");
assumeTrue("propvalue".equals(config.getRawProperty("propname")),
"Raw property 'propname' does not have the expected value 'propvalue', test assumptions not met.");

// Update the property value
child.setProperty("propname", "propvalue2");

Expand All @@ -103,8 +106,10 @@ public void validateApiWhenRemovingChild() {
Mockito.verify(listener, Mockito.times(1)).onConfigUpdated(any());

// Validate initial state
assertEquals("propvalue", config.getProperty("propname").get());
assertEquals("propvalue", config.getRawProperty("propname"));
assumeTrue("propvalue".equals(config.getProperty("propname").orElse(null)),
"Property 'propname' does not have the expected value 'propvalue', test assumptions not met.");
assumeTrue("propvalue".equals(config.getRawProperty("propname")),
"Raw property 'propname' does not have the expected value 'propvalue', test assumptions not met.");

// Remove the child
config.removeConfig(Layers.APPLICATION, child.getName());
Expand Down
Loading