Skip to content

Commit

Permalink
Merge pull request #205 from scalecube/bug/204
Browse files Browse the repository at this point in the history
Fixed bug/204
  • Loading branch information
artem-v authored May 6, 2023
2 parents 78650d2 + 7f44a66 commit 29bfe5a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ private boolean isMultimap(ParameterizedType paramType) {
} else if (type == Long.TYPE || type == Long.class) {
return Long::parseLong;
} else {
throw new IllegalArgumentException(
"ObjectPropertyField: unsupported type on field: " + field);
return Function.identity();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,27 @@ void testSkipStaticOrFinalFieldInObjectPropertryClass() {
assertEquals(1, config.finalInt);
}

@Test
void testSkipInjectedConfigPojo() {
when(configSource.loadConfig())
.thenReturn(
toConfigProps(
mapBuilder()
.put("io.scalecube.config.user", "user")
.put("io.scalecube.config.password", "password")
.build()));

ConfigRegistryImpl configRegistry = newConfigRegistry(configSource);

final SkipInjectedConfigPojo configPojo =
configRegistry.objectProperty(SkipInjectedConfigPojo.class).value().get();

assertEquals("user", configPojo.user);
assertEquals("password", configPojo.password);
assertNotNull(configPojo.testConfig);
assertNotNull(configPojo.intObjectSettings);
}

// Failure scenarios

@Test
Expand Down Expand Up @@ -552,4 +573,11 @@ public static class ConnectorSettings {
public static class IntObjectSettings {
int anInt;
}

public static class SkipInjectedConfigPojo {
String user;
String password;
IntObjectSettings intObjectSettings = new IntObjectSettings();
TestConfig testConfig = new TestConfig();
}
}

0 comments on commit 29bfe5a

Please sign in to comment.