|
|
|
|
@ -101,22 +101,30 @@ class EndpointIdTests {
@@ -101,22 +101,30 @@ class EndpointIdTests {
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void ofWhenMigratingLegacyNameRemovesDots(CapturedOutput output) { |
|
|
|
|
EndpointId.resetLoggedWarnings(); |
|
|
|
|
MockEnvironment environment = new MockEnvironment(); |
|
|
|
|
environment.setProperty("management.endpoints.migrate-legacy-ids", "true"); |
|
|
|
|
EndpointId endpointId = EndpointId.of(environment, "foo.bar"); |
|
|
|
|
assertThat(endpointId.toString()).isEqualTo("foobar"); |
|
|
|
|
EndpointId endpointId = migrateLegacyName("one.two.three"); |
|
|
|
|
assertThat(endpointId.toString()).isEqualTo("onetwothree"); |
|
|
|
|
assertThat(output).doesNotContain("contains invalid characters"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void ofWhenMigratingLegacyNameRemovesHyphens(CapturedOutput output) { |
|
|
|
|
EndpointId endpointId = migrateLegacyName("one-two-three"); |
|
|
|
|
assertThat(endpointId.toString()).isEqualTo("onetwothree"); |
|
|
|
|
assertThat(output).doesNotContain("contains invalid characters"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void ofWhenMigratingLegacyNameRemovesMixOfDashAndDot(CapturedOutput output) { |
|
|
|
|
EndpointId endpointId = migrateLegacyName("one.two-three"); |
|
|
|
|
assertThat(endpointId.toString()).isEqualTo("onetwothree"); |
|
|
|
|
assertThat(output).doesNotContain("contains invalid characters"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private EndpointId migrateLegacyName(String name) { |
|
|
|
|
EndpointId.resetLoggedWarnings(); |
|
|
|
|
MockEnvironment environment = new MockEnvironment(); |
|
|
|
|
environment.setProperty("management.endpoints.migrate-legacy-ids", "true"); |
|
|
|
|
EndpointId endpointId = EndpointId.of(environment, "foo-bar"); |
|
|
|
|
assertThat(endpointId.toString()).isEqualTo("foobar"); |
|
|
|
|
assertThat(output).doesNotContain("contains invalid characters"); |
|
|
|
|
return EndpointId.of(environment, name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|