EndpointInfoBuilder { public EndpointInfo build() { checkState(availableMimeTypes != null && !availableMimeTypes.isEmpty(), "Should at least have an available media type."); return new EndpointInfo(hostnamePattern, pathMapping, regexPathPrefix, fragment, defaultMimeType, availableMimeTypes); } EndpointInfoBuilder(String hostnamePattern, String pathMapping); EndpointInfoBuilder regexPathPrefix(String regexPathPrefix); EndpointInfoBuilder fragment(String fragment); EndpointInfoBuilder defaultFormat(SerializationFormat defaultFormat); EndpointInfoBuilder defaultMimeType(MediaType defaultMimeType); EndpointInfoBuilder availableFormats(SerializationFormat... availableFormats); EndpointInfoBuilder availableFormats(Iterable<SerializationFormat> availableFormats); EndpointInfoBuilder availableMimeTypes(MediaType... availableMimeTypes); EndpointInfoBuilder availableMimeTypes(Iterable<MediaType> availableMimeTypes); EndpointInfo build(); @Override String toString();  }
@Test void testBuild() { final EndpointInfoBuilder endpointInfoBuilder = EndpointInfo.builder("*", "/foo"); final EndpointInfo endpointInfo = endpointInfoBuilder.availableMimeTypes(MediaType.JSON_UTF_8) .build(); assertThat(endpointInfo).isEqualTo(new EndpointInfo("*", "/foo", "", "", null, ImmutableSet.of(MediaType.JSON_UTF_8))); }