|
| 1 | +/* |
| 2 | + * Copyright 2018 the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.springframework.data.rest.webmvc.config; |
| 17 | + |
| 18 | +import static org.assertj.core.api.Assertions.*; |
| 19 | +import static org.mockito.Mockito.*; |
| 20 | + |
| 21 | +import org.junit.Test; |
| 22 | +import org.springframework.core.MethodParameter; |
| 23 | +import org.springframework.data.repository.support.Repositories; |
| 24 | +import org.springframework.data.rest.core.mapping.ResourceMappings; |
| 25 | +import org.springframework.data.rest.core.mapping.ResourceMetadata; |
| 26 | +import org.springframework.data.rest.webmvc.BaseUri; |
| 27 | +import org.springframework.web.method.support.HandlerMethodArgumentResolver; |
| 28 | + |
| 29 | +/** |
| 30 | + * Unit tests for {@link ResourceMetadataHandlerMethodArgumentResolver}. |
| 31 | + * |
| 32 | + * @author Oliver Gierke |
| 33 | + */ |
| 34 | +public class ResourceMetadataHandlerMethodArgumentResolverUnitTests { |
| 35 | + |
| 36 | + @Test // DATAREST-1250 |
| 37 | + public void supportsResourceMetadataParameterType() { |
| 38 | + |
| 39 | + HandlerMethodArgumentResolver resolver = new ResourceMetadataHandlerMethodArgumentResolver(mock(Repositories.class), |
| 40 | + mock(ResourceMappings.class), BaseUri.NONE); |
| 41 | + |
| 42 | + MethodParameter parameter = mock(MethodParameter.class); |
| 43 | + doReturn(ResourceMetadata.class).when(parameter).getParameterType(); |
| 44 | + |
| 45 | + assertThat(resolver.supportsParameter(parameter)).isTrue(); |
| 46 | + } |
| 47 | +} |
0 commit comments