@Test public void buildShouldBuildEveryMethodConfigAndReturnAnInterfaceConfigWithThem() throws Exception { DefaultInterfaceConfig expected = mock(DefaultInterfaceConfig.class); MethodConfig mockMethodConfigM1 = mock(MethodConfig.class); MethodConfig mockMethodConfigM2 = mock(MethodConfig.class); Map<Method, MethodConfig> expectedMethodConfigs = new HashMap<Method, MethodConfig>(); expectedMethodConfigs.put(M1, mockMethodConfigM1); expectedMethodConfigs.put(M2, mockMethodConfigM2); when(mockM1MethodConfigBuilder.build()).thenReturn(mockMethodConfigM1); when(mockM2MethodConfigBuilder.build()).thenReturn(mockMethodConfigM2); whenNew(DefaultInterfaceConfig.class).withArguments( interfaze, expectedMethodConfigs).thenReturn(expected); InterfaceConfig actual = toTest.build(); assertSame(expected, actual); }
public InterfaceConfig build() throws Exception { Map<Method, MethodConfig> mConfig = new HashMap<Method, MethodConfig>(); for (Map.Entry<Method, MethodConfigBuilder> entry : methodBuilders.entrySet()) { mConfig.put(entry.getKey(), entry.getValue().build()); } return new DefaultInterfaceConfig(interfaze, mConfig); }
DefaultInterfaceConfigBuilder extends ConfigBuilder implements InterfaceConfigBuilder { public InterfaceConfig build() throws Exception { Map<Method, MethodConfig> mConfig = new HashMap<Method, MethodConfig>(); for (Map.Entry<Method, MethodConfigBuilder> entry : methodBuilders.entrySet()) { mConfig.put(entry.getKey(), entry.getValue().build()); } return new DefaultInterfaceConfig(interfaze, mConfig); } }
DefaultInterfaceConfigBuilder extends ConfigBuilder implements InterfaceConfigBuilder { public InterfaceConfig build() throws Exception { Map<Method, MethodConfig> mConfig = new HashMap<Method, MethodConfig>(); for (Map.Entry<Method, MethodConfigBuilder> entry : methodBuilders.entrySet()) { mConfig.put(entry.getKey(), entry.getValue().build()); } return new DefaultInterfaceConfig(interfaze, mConfig); } DefaultInterfaceConfigBuilder(Class interfaze, CRestConfig crestConfig, ComponentRegistry<String,Deserializer> mimeDeserializerRegistry, ComponentRegistry<Class<?>, Serializer> classSerializerRegistry); }
DefaultInterfaceConfigBuilder extends ConfigBuilder implements InterfaceConfigBuilder { public InterfaceConfig build() throws Exception { Map<Method, MethodConfig> mConfig = new HashMap<Method, MethodConfig>(); for (Map.Entry<Method, MethodConfigBuilder> entry : methodBuilders.entrySet()) { mConfig.put(entry.getKey(), entry.getValue().build()); } return new DefaultInterfaceConfig(interfaze, mConfig); } DefaultInterfaceConfigBuilder(Class interfaze, CRestConfig crestConfig, ComponentRegistry<String,Deserializer> mimeDeserializerRegistry, ComponentRegistry<Class<?>, Serializer> classSerializerRegistry); InterfaceConfig build(); MethodConfigBuilder startMethodConfig(Method meth); InterfaceConfigBuilder setMethodsCharset(Charset charset); InterfaceConfigBuilder setMethodsSocketTimeout(int socketTimeout); InterfaceConfigBuilder setMethodsConnectionTimeout(int connectionTimeout); InterfaceConfigBuilder setMethodsRequestInterceptor(Class<? extends RequestInterceptor> requestInterceptorClass); InterfaceConfigBuilder setMethodsResponseHandler(Class<? extends ResponseHandler> responseHandlerClass); InterfaceConfigBuilder setMethodsErrorHandler(Class<? extends ErrorHandler> errorHandlerClass); InterfaceConfigBuilder setMethodsRetryHandler(Class<? extends RetryHandler> retryHandlerClass); InterfaceConfigBuilder setMethodsEntityWriter(Class<? extends EntityWriter> entityWriterClass); InterfaceConfigBuilder setMethodsConsumes(String... mimeTypes); InterfaceConfigBuilder setMethodsDeserializer(Class<? extends Deserializer> deserializerClass); InterfaceConfigBuilder setMethodsProduces(String contentType); InterfaceConfigBuilder setMethodsType(MethodType meth); InterfaceConfigBuilder appendMethodsPath(String path); InterfaceConfigBuilder setMethodsEndPoint(String endPoint); ParamConfigBuilder startMethodsExtraParamConfig(); InterfaceConfigBuilder setParamsSerializer(Class<? extends Serializer> paramSerializerClass); InterfaceConfigBuilder setParamsEncoded(boolean encoded); InterfaceConfigBuilder setParamsListSeparator(String separator); @Override String toString(); }
DefaultInterfaceConfigBuilder extends ConfigBuilder implements InterfaceConfigBuilder { public InterfaceConfig build() throws Exception { Map<Method, MethodConfig> mConfig = new HashMap<Method, MethodConfig>(); for (Map.Entry<Method, MethodConfigBuilder> entry : methodBuilders.entrySet()) { mConfig.put(entry.getKey(), entry.getValue().build()); } return new DefaultInterfaceConfig(interfaze, mConfig); } DefaultInterfaceConfigBuilder(Class interfaze, CRestConfig crestConfig, ComponentRegistry<String,Deserializer> mimeDeserializerRegistry, ComponentRegistry<Class<?>, Serializer> classSerializerRegistry); InterfaceConfig build(); MethodConfigBuilder startMethodConfig(Method meth); InterfaceConfigBuilder setMethodsCharset(Charset charset); InterfaceConfigBuilder setMethodsSocketTimeout(int socketTimeout); InterfaceConfigBuilder setMethodsConnectionTimeout(int connectionTimeout); InterfaceConfigBuilder setMethodsRequestInterceptor(Class<? extends RequestInterceptor> requestInterceptorClass); InterfaceConfigBuilder setMethodsResponseHandler(Class<? extends ResponseHandler> responseHandlerClass); InterfaceConfigBuilder setMethodsErrorHandler(Class<? extends ErrorHandler> errorHandlerClass); InterfaceConfigBuilder setMethodsRetryHandler(Class<? extends RetryHandler> retryHandlerClass); InterfaceConfigBuilder setMethodsEntityWriter(Class<? extends EntityWriter> entityWriterClass); InterfaceConfigBuilder setMethodsConsumes(String... mimeTypes); InterfaceConfigBuilder setMethodsDeserializer(Class<? extends Deserializer> deserializerClass); InterfaceConfigBuilder setMethodsProduces(String contentType); InterfaceConfigBuilder setMethodsType(MethodType meth); InterfaceConfigBuilder appendMethodsPath(String path); InterfaceConfigBuilder setMethodsEndPoint(String endPoint); ParamConfigBuilder startMethodsExtraParamConfig(); InterfaceConfigBuilder setParamsSerializer(Class<? extends Serializer> paramSerializerClass); InterfaceConfigBuilder setParamsEncoded(boolean encoded); InterfaceConfigBuilder setParamsListSeparator(String separator); @Override String toString();  }