DefaultParamConfigBuilder extends ConfigBuilder implements ParamConfigBuilder { public ParamConfig build() throws Exception { validate(); return new DefaultParamConfig( genericType, clazz, name, defaultValue, type, metas, serializer != null ? instantiate(serializer) : classSerializerRegistry.get(clazz), (COOKIE.equals(type) || HEADER.equals(type)) ? true : encoded, paramProcessor != null ? instantiate(paramProcessor) : ParamProcessors.newInstance(type, listSeparator)); } DefaultParamConfigBuilder(CRestConfig crestConfig, ComponentRegistry<Class<?>, Serializer> classSerializerRegistry, Class<?> clazz, Type genericType);   DefaultParamConfigBuilder(CRestConfig crestConfig, ComponentRegistry<Class<?>, Serializer> classSerializerRegistry, Class<?> clazz, Type genericType, MethodConfigBuilder parent); ParamConfig build(); ParamConfigBuilder setName(String name); ParamConfigBuilder setDefaultValue(String defaultValue); ParamConfigBuilder setType(ParamType type); ParamConfigBuilder setListSeparator(String listSeparator); ParamConfigBuilder setEncoded(boolean encoded); ParamConfigBuilder setMetaDatas(Map<String,Object> metadatas); ParamConfigBuilder setSerializer(Class<? extends Serializer> serializerClass); ParamConfigBuilder forCookie(); ParamConfigBuilder forQuery(); ParamConfigBuilder forPath(); ParamConfigBuilder forForm(); ParamConfigBuilder forHeader(); ParamConfigBuilder forMatrix(); ParamConfigBuilder forMultiPart(); @Override String toString();  }
@Test(expected=IllegalStateException.class) public void shouldUseDefaultValueForName() throws Exception { DefaultParamConfigBuilder toTest = newToTest(); try { toTest.build(); } catch (Exception e) { assertEquals("Parameter name is mandatory. This is probably due to a missing or empty named param annotation (one of the following: @CookieParam, @FormParam, @HeaderParam, @MatrixParam, @MultiPartParam, @PathParam, @QueryParam).\n" + "Location information:\n" + "Param[class=interface java.lang.Comparable,type=QUERY,method="+methodConfigBuilder+"]", e.getMessage()); throw e; } }
@Test public void shouldOverrideValueForName() throws Exception { mockOverride(ParamConfig.PARAM_CONFIG_DEFAULT_NAME, "value"); DefaultParamConfigBuilder toTest = newToTest(); ParamConfig actual = toTest.build(); assertCommons(actual); assertEquals("value", actual.getName()); }