EndpointTrait extends AbstractTrait implements ToSmithyBuilder<EndpointTrait> { public static Builder builder() { return new Builder(); } private  EndpointTrait(Builder builder); SmithyPattern getHostPrefix(); static Builder builder(); @Override Builder toBuilder(); static final ShapeId ID; }
@Test public void literalsMustNotContainAdjacentLabels() { Throwable thrown = Assertions.assertThrows(InvalidPatternException.class, () -> { EndpointTrait.builder() .hostPrefix("foo-{baz}{bar}") .build(); }); assertThat(thrown.getMessage(), containsString("Host labels must not be adjacent")); }
@Test public void literalsMustNotContainOpenBrace() { Throwable thrown = Assertions.assertThrows(InvalidPatternException.class, () -> { EndpointTrait.builder() .hostPrefix("foo-{baz") .build(); }); assertThat(thrown.getMessage(), containsString("Unclosed label found in pattern")); }
@Test public void literalsMustNotContainTrailingOpenBrace() { Throwable thrown = Assertions.assertThrows(InvalidPatternException.class, () -> { EndpointTrait.builder() .hostPrefix("foo-{") .build(); }); assertThat(thrown.getMessage(), containsString("Unclosed label found in pattern")); }
@Test public void literalsMustNotContainCloseBrace() { Throwable thrown = Assertions.assertThrows(InvalidPatternException.class, () -> { EndpointTrait.builder() .hostPrefix("foo-}baz") .build(); }); assertThat(thrown.getMessage(), containsString("Literal segments must not contain `}`")); }