Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoyanchev committed Apr 27, 2022
1 parent 4bddbd3 commit bb44c0e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


/**
* Shortcut for {@link HttpRequest} for HTTP GET requests.
*
* @author Rossen Stoyanchev
* @since 6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.core.annotation.AliasFor;

/**
* Shortcut for {@link HttpRequest} for HTTP POST requests.
*
* @author Rossen Stoyanchev
* @since 6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.core.annotation.AliasFor;

/**
* Shortcut for {@link HttpRequest} for HTTP PUT requests.
*
* @author Rossen Stoyanchev
* @since 6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.ResolvableType;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
Expand Down Expand Up @@ -56,7 +55,7 @@ public class HttpRequestDefinition {

@Nullable
private URI uri;

@Nullable
private String uriTemplate;

Expand All @@ -80,7 +79,7 @@ public class HttpRequestDefinition {

@Nullable
private Publisher<?> bodyPublisher;

@Nullable
private ParameterizedTypeReference<?> bodyPublisherElementType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import org.springframework.aop.framework.ProxyFactory;
import org.springframework.core.MethodIntrospector;
Expand Down Expand Up @@ -91,7 +89,7 @@ private HttpServiceMethod initServiceMethod(Method method, Class<?> serviceType)


/**
*
* {@link MethodInterceptor} that invokes an {@link HttpServiceMethod}.
*/
private static final class HttpServiceMethodInterceptor implements MethodInterceptor {

Expand All @@ -101,9 +99,8 @@ private HttpServiceMethodInterceptor(List<HttpServiceMethod> methods) {
methods.forEach(serviceMethod -> this.serviceMethodMap.put(serviceMethod.getMethod(), serviceMethod));
}

@Nullable
@Override
public Object invoke(@NotNull MethodInvocation invocation) throws Throwable {
public Object invoke(MethodInvocation invocation) throws Throwable {
Method method = invocation.getMethod();
HttpServiceMethod httpServiceMethod = this.serviceMethodMap.get(method);
return httpServiceMethod.invoke(invocation.getArguments());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
*
* Support to create a client proxy for an HTTP service annotated with
* {@link org.springframework.web.service.annotation.HttpRequest} methods.
*/
@NonNullApi
@NonNullFields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public class HttpMethodArgumentResolverTests {

private final Service service = this.clientAdapter.createService(Service.class, new HttpMethodArgumentResolver());


@Test
void shouldResolveRequestMethodFromArgument() {
this.service.execute(HttpMethod.GET);
assertThat(getActualMethod()).isEqualTo(HttpMethod.GET);
}

@Test
void shouldIgnoreArgumentsNotMatchingType() {
this.service.execute("test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Map;
import java.util.Optional;

import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;

import org.springframework.core.convert.support.DefaultConversionService;
Expand Down Expand Up @@ -143,7 +142,6 @@ private void assertPathVariable(String name, @Nullable String expectedValue) {
assertThat(getActualUriVariables().get(name)).isEqualTo(expectedValue);
}

@NotNull
private Map<String, String> getActualUriVariables() {
return this.clientAdapter.getRequestDefinition().getUriVariables();
}
Expand Down

0 comments on commit bb44c0e

Please sign in to comment.