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

Split the PropertyTest.test into testPropertyValuesUpdateAndEffect and testServiceInitializationWithDefaultProperties #715

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 @@ -95,20 +95,32 @@ public String toString() {
}

@Test
public void test() throws ConfigException {
public void testServiceInitializationWithDefaultProperties() {
SettableConfig config = new DefaultSettableConfig();
DefaultPropertyFactory factory = DefaultPropertyFactory.from(config);

MyService service = new MyService(factory);

assertEquals(1, (int)service.value.get());
assertEquals(2, (int)service.value2.get());
// Verify initial property values
assertEquals(1, (int) service.value.get());
assertEquals(2, (int) service.value2.get());
// Verify setValue() was called once for each initialization
assertEquals(0, service.setValueCallsCounter.get());
}

@Test
public void testPropertyValuesUpdateAndEffect() {
SettableConfig config = new DefaultSettableConfig();
DefaultPropertyFactory factory = DefaultPropertyFactory.from(config);
MyService service = new MyService(factory);

// Setting up properties
config.setProperty("foo", "123");

// Assertions after properties update
assertEquals(123, (int)service.value.get());
assertEquals(123, (int)service.value2.get());
// setValue() is called once when we init to 1 and twice when we set foo to 123.
// setValue() is called once for each property update
assertEquals(1, service.setValueCallsCounter.get());
}

Expand Down
Loading