DATACMNS-973 - Migrate ticket references in test code to Spring Framework style.

This commit is contained in:
Mark Paluch
2017-01-13 08:45:25 +01:00
parent a946d651ff
commit 4eb1ae8de2
146 changed files with 1080 additions and 3893 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,10 +47,7 @@ public class HateoasPageableHandlerMethodArgumentResolverUnitTests extends
assertUriStringFor(REFERENCE_WITH_SORT_FIELDS, basicString + "&sort=firstname,lastname,asc");
}
/**
* @see DATACMNS-343
*/
@Test
@Test // DATACMNS-343
public void replacesExistingPaginationInformation() throws Exception {
MethodParameter parameter = new MethodParameter(Sample.class.getMethod("supportedMethod", Pageable.class), 0);
@@ -69,18 +66,12 @@ public class HateoasPageableHandlerMethodArgumentResolverUnitTests extends
assertThat(size.get(0), is("20"));
}
/**
* @see DATACMNS-335
*/
@Test
@Test // DATACMNS-335
public void preventsPageSizeFromExceedingMayValueIfConfiguredOnWrite() throws Exception {
assertUriStringFor(new PageRequest(0, 200), "page=0&size=100");
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void appendsTemplateVariablesCorrectly() {
assertTemplateEnrichment("/foo", "{?page,size,sort}");
@@ -91,10 +82,7 @@ public class HateoasPageableHandlerMethodArgumentResolverUnitTests extends
assertTemplateEnrichment("/foo?page=1&size=10&sort=foo,asc", "");
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void returnsCustomizedTemplateVariables() {
UriComponents uriComponents = UriComponentsBuilder.fromPath("/foo").build();
@@ -106,10 +94,7 @@ public class HateoasPageableHandlerMethodArgumentResolverUnitTests extends
assertThat(variables, is("{?foo,size,sort}"));
}
/**
* @see DATACMNS-563
*/
@Test
@Test // DATACMNS-563
public void enablingOneIndexedParameterReturnsOneForFirstPage() {
HateoasPageableHandlerMethodArgumentResolver resolver = getResolver();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,18 +44,12 @@ public class HateoasSortHandlerMethodArgumentResolverUnitTests extends SortHandl
"sort=foo,bar,asc&sort=foobar,desc");
}
/**
* @see DATACMNS-407
*/
@Test
@Test // DATACMNS-407
public void replacesExistingRequestParameters() throws Exception {
assertUriStringFor(SORT, "/?sort=firstname,lastname,desc", "/?sort=foo,asc");
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void returnCorrectTemplateVariables() {
UriComponents uriComponents = UriComponentsBuilder.fromPath("/").build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,74 +63,47 @@ public class JsonProjectingMethodInterceptorFactoryUnitTests {
this.customer = projectionFactory.createProjection(Customer.class, new ByteArrayInputStream(json.getBytes()));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessSimpleProperty() {
assertThat(customer.getFirstname(), is("Dave"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessPropertyWithExplicitAnnotation() {
assertThat(customer.getBar(), is("Dave"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessPropertyWithComplexReturnType() {
assertThat(customer.getAddress(), is(new Address("01097", "Dresden")));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessComplexPropertyWithProjection() {
assertThat(customer.getAddressProjection().getCity(), is("Dresden"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessPropertyWithNestedJsonPath() {
assertThat(customer.getNestedZipCode(), is("01097"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessCollectionProperty() {
assertThat(customer.getAddresses().get(0), is(new Address("01097", "Dresden")));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessPropertyOnNestedProjection() {
assertThat(customer.getAddressProjections().get(0).getZipCode(), is("01097"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessPropertyThatUsesJsonPathProjectionInTurn() {
assertThat(customer.getAnotherAddressProjection().getZipCodeButNotCity(), is("01097"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessCollectionPropertyThatUsesJsonPathProjectionInTurn() {
List<AnotherAddressProjection> projections = customer.getAnotherAddressProjections();
@@ -139,10 +112,7 @@ public class JsonProjectingMethodInterceptorFactoryUnitTests {
assertThat(projections.get(0).getZipCodeButNotCity(), is("01097"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessAsCollectionPropertyThatUsesJsonPathProjectionInTurn() {
Set<AnotherAddressProjection> projections = customer.getAnotherAddressProjectionAsCollection();
@@ -151,10 +121,7 @@ public class JsonProjectingMethodInterceptorFactoryUnitTests {
assertThat(projections.iterator().next().getZipCodeButNotCity(), is("01097"));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void accessNestedPropertyButStayOnRootLevel() {
Name name = customer.getName();
@@ -163,10 +130,7 @@ public class JsonProjectingMethodInterceptorFactoryUnitTests {
assertThat(name.getFirstname(), is("Dave"));
}
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void accessNestedFields() {
assertThat(customer.getNestedCity(), is("Dresden"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,10 +42,7 @@ import org.springframework.format.support.DefaultFormattingConversionService;
*/
public class MapDataBinderUnitTests {
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void honorsFormattingAnnotationOnAccessor() {
Date reference = new Date();
@@ -59,10 +56,7 @@ public class MapDataBinderUnitTests {
assertThat(bind(values), hasEntry("foo", (Object) nested));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
@SuppressWarnings("rawtypes")
public void bindsNestedCollectionElement() {
@@ -77,10 +71,7 @@ public class MapDataBinderUnitTests {
assertThat(result, is((Map) singletonMap("foo", singletonMap("bar", singletonMap("fooBar", list)))));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
@SuppressWarnings("rawtypes")
public void bindsNestedPrimitive() {
@@ -97,10 +88,7 @@ public class MapDataBinderUnitTests {
assertThat(result, is((Map) singletonMap("foo", dave)));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void skipsPropertyNotExposedByTheTypeHierarchy() {
MutablePropertyValues values = new MutablePropertyValues();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,10 +46,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
this.supportedMethodParameter = new MethodParameter(Sample.class.getMethod("supportedMethod", Pageable.class), 0);
}
/**
* @see DATACMNS-335
*/
@Test
@Test // DATACMNS-335
public void preventsPageSizeFromExceedingMayValueIfConfigured() throws Exception {
// Read side
@@ -92,10 +89,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertSupportedAndResult(parameter, new PageRequest(2, 10), request);
}
/**
* @see DATACMNS-377
*/
@Test
@Test // DATACMNS-377
public void usesDefaultPageSizeIfRequestPageSizeIsLessThanOne() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -105,10 +99,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertSupportedAndResult(supportedMethodParameter, DEFAULT_PAGE_REQUEST, request);
}
/**
* @see DATACMNS-377
*/
@Test
@Test // DATACMNS-377
public void rejectsInvalidCustomDefaultForPageSize() throws Exception {
MethodParameter parameter = new MethodParameter(Sample.class.getMethod("invalidDefaultPageSize", Pageable.class), 0);
@@ -119,10 +110,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertSupportedAndResult(parameter, DEFAULT_PAGE_REQUEST);
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void fallsBackToFirstPageIfNegativePageNumberIsGiven() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -131,10 +119,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertSupportedAndResult(supportedMethodParameter, DEFAULT_PAGE_REQUEST, request);
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void pageParamIsNotNumeric() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -143,10 +128,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertSupportedAndResult(supportedMethodParameter, DEFAULT_PAGE_REQUEST, request);
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void sizeParamIsNotNumeric() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -155,10 +137,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertSupportedAndResult(supportedMethodParameter, DEFAULT_PAGE_REQUEST, request);
}
/**
* @see DATACMNS-477
*/
@Test
@Test // DATACMNS-477
public void returnsNullIfFallbackIsNullAndNoParametersGiven() throws Exception {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -168,10 +147,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
resolver);
}
/**
* @see DATACMNS-477
*/
@Test
@Test // DATACMNS-477
public void returnsNullIfFallbackIsNullAndOnlyPageIsGiven() throws Exception {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -184,10 +160,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
is(nullValue()));
}
/**
* @see DATACMNS-477
*/
@Test
@Test // DATACMNS-477
public void returnsNullIfFallbackIsNullAndOnlySizeIsGiven() throws Exception {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -200,10 +173,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
is(nullValue()));
}
/**
* @see DATACMNS-563
*/
@Test
@Test // DATACMNS-563
public void considersOneIndexedParametersSetting() {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -216,10 +186,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
.getPageNumber(), is(0));
}
/**
* @see DATACMNS-640
*/
@Test
@Test // DATACMNS-640
public void usesNullSortIfNoDefaultIsConfiguredAndPageAndSizeAreGiven() {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -236,10 +203,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertThat(result.getSort(), is(nullValue()));
}
/**
* @see DATACMNS-692
*/
@Test
@Test // DATACMNS-692
public void oneIndexedParametersDefaultsIndexOutOfRange() {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -253,10 +217,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertThat(result.getPageNumber(), is(0));
}
/**
* @see DATACMNS-761
*/
@Test
@Test // DATACMNS-761
public void returnsCorrectPageSizeForOneIndexParameters() {
PageableHandlerMethodArgumentResolver resolver = getResolver();
@@ -270,10 +231,7 @@ public class PageableHandlerMethodArgumentResolverUnitTests extends PageableDefa
assertThat(result.getPageSize(), is(10));
}
/**
* @see DATACMNS-929
*/
@Test
@Test // DATACMNS-929
public void detectsFallbackPageableIfNullOneIsConfigured() {
PageableHandlerMethodArgumentResolver resolver = getResolver();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,10 +52,7 @@ public class PagedResourcesAssemblerArgumentResolverUnitTests {
this.resolver = new PagedResourcesAssemblerArgumentResolver(hateoasPageableHandlerMethodArgumentResolver, null);
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void createsPlainAssemblerWithoutContext() throws Exception {
Method method = Controller.class.getMethod("noContext", PagedResourcesAssembler.class);
@@ -65,40 +62,28 @@ public class PagedResourcesAssemblerArgumentResolverUnitTests {
assertThat(result, is(not(instanceOf(MethodParameterAwarePagedResourcesAssembler.class))));
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void selectsUniquePageableParameter() throws Exception {
Method method = Controller.class.getMethod("unique", PagedResourcesAssembler.class, Pageable.class);
assertSelectsParameter(method, 1);
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void selectsUniquePageableParameterForQualifiedAssembler() throws Exception {
Method method = Controller.class.getMethod("unnecessarilyQualified", PagedResourcesAssembler.class, Pageable.class);
assertSelectsParameter(method, 1);
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void selectsUniqueQualifiedPageableParameter() throws Exception {
Method method = Controller.class.getMethod("qualifiedUnique", PagedResourcesAssembler.class, Pageable.class);
assertSelectsParameter(method, 1);
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void selectsQualifiedPageableParameter() throws Exception {
Method method = Controller.class.getMethod("qualified", PagedResourcesAssembler.class, Pageable.class,
@@ -106,34 +91,22 @@ public class PagedResourcesAssemblerArgumentResolverUnitTests {
assertSelectsParameter(method, 1);
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void rejectsAmbiguousPageableParameters() throws Exception {
assertRejectsAmbiguity("unqualifiedAmbiguity");
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void rejectsAmbiguousPageableParametersForQualifiedAssembler() throws Exception {
assertRejectsAmbiguity("assemblerQualifiedAmbiguity");
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void rejectsAmbiguityWithoutMatchingQualifiers() throws Exception {
assertRejectsAmbiguity("noMatchingQualifiers");
}
/**
* @see DATACMNS-419
*/
@Test
@Test // DATACMNS-419
public void doesNotFailForTemplatedMethodMapping() throws Exception {
Method method = Controller.class.getMethod("methodWithPathVariable", PagedResourcesAssembler.class);
@@ -142,10 +115,7 @@ public class PagedResourcesAssemblerArgumentResolverUnitTests {
assertThat(result, is(notNullValue()));
}
/**
* @see DATACMNS-513
*/
@Test
@Test // DATACMNS-513
public void detectsMappingOfInvokedSubType() throws Exception {
Method method = Controller.class.getMethod("methodWithMapping", PagedResourcesAssembler.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -116,10 +116,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(resources.getLink(Link.REL_NEXT).getHref(), startsWith(link.getHref()));
}
/**
* @see DATACMNS-358
*/
@Test
@Test // DATACMNS-358
public void createsPagedResourcesForOneIndexedArgumentResolver() {
resolver.setOneIndexedParameters(true);
@@ -130,11 +127,7 @@ public class PagedResourcesAssemblerUnitTests {
assembler.toResource(page);
}
/**
* @see DATACMNS-418
* @see DATACMNS-515
*/
@Test
@Test // DATACMNS-418, DATACMNS-515
public void createsACanonicalLinkWithoutTemplateParameters() {
PagedResources<Resource<Person>> resources = assembler.toResource(createPage(1));
@@ -143,10 +136,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(selfLink.getHref(), endsWith("localhost"));
}
/**
* @see DATACMNS-418
*/
@Test
@Test // DATACMNS-418
public void invokesCustomElementResourceAssembler() {
PersonResourceAssembler personAssembler = new PersonResourceAssembler();
@@ -160,10 +150,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(content.iterator().next().name, is("Dave"));
}
/**
* @see DATAMCNS-563
*/
@Test
@Test // DATAMCNS-563
public void createsPaginationLinksForOneIndexedArgumentResolverCorrectly() {
HateoasPageableHandlerMethodArgumentResolver argumentResolver = new HateoasPageableHandlerMethodArgumentResolver();
@@ -179,10 +166,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(getQueryParameters(resource.getLink("next")), hasEntry("page", "3"));
}
/**
* @see DATACMNS-515
*/
@Test
@Test // DATACMNS-515
public void generatedLinksShouldNotBeTemplated() {
PagedResources<Resource<Person>> resources = assembler.toResource(createPage(1));
@@ -192,10 +176,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(resources.getLink(Link.REL_PREVIOUS).getHref(), endsWith("?page=0&size=1"));
}
/**
* @see DATACMNS-699
*/
@Test
@Test // DATACMNS-699
public void generatesEmptyPagedResourceWithEmbeddedWrapper() {
PagedResources<?> result = assembler.toEmptyResource(EMPTY_PAGE, Person.class, null);
@@ -208,26 +189,17 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(((EmbeddedWrapper) element).getRelTargetType(), is(typeCompatibleWith(Person.class)));
}
/**
* @see DATACMNS-699
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-699
public void emptyPageCreatorRejectsPageWithContent() {
assembler.toEmptyResource(createPage(1), Person.class, null);
}
/**
* @see DATACMNS-699
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-699
public void emptyPageCreatorRejectsNullType() {
assembler.toEmptyResource(EMPTY_PAGE, null, null);
}
/**
* @see DATACMNS-701
*/
@Test
@Test // DATACMNS-701
public void addsFirstAndLastLinksForMultiplePages() {
PagedResources<Resource<Person>> resources = assembler.toResource(createPage(1));
@@ -236,10 +208,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(resources.getLink(Link.REL_LAST).getHref(), endsWith("?page=2&size=1"));
}
/**
* @see DATACMNS-701
*/
@Test
@Test // DATACMNS-701
public void addsFirstAndLastLinksForFirstPage() {
PagedResources<Resource<Person>> resources = assembler.toResource(createPage(0));
@@ -248,10 +217,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(resources.getLink(Link.REL_LAST).getHref(), endsWith("?page=2&size=1"));
}
/**
* @see DATACMNS-701
*/
@Test
@Test // DATACMNS-701
public void addsFirstAndLastLinksForLastPage() {
PagedResources<Resource<Person>> resources = assembler.toResource(createPage(2));
@@ -260,10 +226,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(resources.getLink(Link.REL_LAST).getHref(), endsWith("?page=2&size=1"));
}
/**
* @see DATACMNS-701
*/
@Test
@Test // DATACMNS-701
public void alwaysAddsFirstAndLastLinkIfConfiguredTo() {
PagedResourcesAssembler<Person> assembler = new PagedResourcesAssembler<Person>(resolver, null);
@@ -275,10 +238,7 @@ public class PagedResourcesAssemblerUnitTests {
assertThat(resources.getLink(Link.REL_LAST).getHref(), endsWith("?page=0&size=20"));
}
/**
* @see DATACMNS-802
*/
@Test
@Test // DATACMNS-802
public void usesCustomPagedResources() {
ResourceAssembler<Page<Person>, PagedResources<Resource<Person>>> assembler = new CustomPagedResourcesAssembler<Person>(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,26 +33,17 @@ public class ProjectingJackson2HttpMessageConverterUnitTests {
ProjectingJackson2HttpMessageConverter converter = new ProjectingJackson2HttpMessageConverter();
MediaType ANYTHING_JSON = MediaType.parseMediaType("application/*+json");
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void canReadJsonIntoAnnotatedInterface() {
assertThat(converter.canRead(SampleInterface.class, ANYTHING_JSON), is(true));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void cannotReadUnannotatedInterface() {
assertThat(converter.canRead(UnannotatedInterface.class, ANYTHING_JSON), is(false));
}
/**
* @see DATCMNS-885
*/
@Test
@Test // DATCMNS-885
public void cannotReadClass() {
assertThat(converter.canRead(SampleClass.class, ANYTHING_JSON), is(false));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2015 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,10 +51,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
PARAMETER = new MethodParameter(Controller.class.getMethod("supportedMethod", Sort.class), 0);
}
/**
* @see DATACMNS-351
*/
@Test
@Test // DATACMNS-351
public void fallbackToGivenDefaultSort() throws Exception {
MethodParameter parameter = TestUtils.getParameterOfMethod(getControllerClass(), "unsupportedMethod", String.class);
@@ -66,10 +63,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(sort, is(fallbackSort));
}
/**
* @see DATACMNS-351
*/
@Test
@Test // DATACMNS-351
public void fallbackToDefaultDefaultSort() throws Exception {
MethodParameter parameter = TestUtils.getParameterOfMethod(getControllerClass(), "unsupportedMethod", String.class);
@@ -120,11 +114,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(result, is(nullValue()));
}
/**
* @see DATACMNS-366
* @throws Exception
*/
@Test
@Test // DATACMNS-366
public void requestForMultipleSortPropertiesIsUnmarshalledCorrectly() throws Exception {
MethodParameter parameter = getParameterOfMethod("supportedMethod");
@@ -137,10 +127,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(result, is(new Sort(Direction.ASC, "firstname", "lastname")));
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void parsesEmptySortToNull() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -149,10 +136,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(resolveSort(request, PARAMETER), is(nullValue()));
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void sortParamIsInvalidProperty() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -161,10 +145,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(resolveSort(request, PARAMETER), is(nullValue()));
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void sortParamIsInvalidPropertyWhenMultiProperty() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -173,10 +154,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(resolveSort(request, PARAMETER), is(new Sort(DESC, "property1")));
}
/**
* @see DATACMNS-408
*/
@Test
@Test // DATACMNS-408
public void sortParamIsEmptyWhenMultiParams() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -186,10 +164,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(resolveSort(request, PARAMETER), is(new Sort(DESC, "property")));
}
/**
* @see DATACMNS-379
*/
@Test
@Test // DATACMNS-379
public void parsesCommaParameterForSort() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -198,10 +173,7 @@ public class SortHandlerMethodArgumentResolverUnitTests extends SortDefaultUnitT
assertThat(resolveSort(request, PARAMETER), is(nullValue()));
}
/**
* @see DATACMNS-753, DATACMNS-408
*/
@Test
@Test // DATACMNS-753, DATACMNS-408
public void doesNotReturnNullWhenAnnotatedWithSortDefault() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,10 +44,7 @@ public class XmlBeamHttpMessageConverterUnitTests {
@Mock HttpInputMessage message;
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void findsTopLevelElements() throws Exception {
preparePayload("<user><firstname>Dave</firstname><lastname>Matthews</lastname></user>");
@@ -58,10 +55,7 @@ public class XmlBeamHttpMessageConverterUnitTests {
assertThat(customer.getLastname(), is("Matthews"));
}
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void findsNestedElements() throws Exception {
preparePayload("<user><username><firstname>Dave</firstname><lastname>Matthews</lastname></username></user>");
@@ -72,34 +66,22 @@ public class XmlBeamHttpMessageConverterUnitTests {
assertThat(customer.getLastname(), is("Matthews"));
}
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void supportsAnnotatedInterface() {
assertThat(converter.canRead(Customer.class, MediaType.APPLICATION_XML), is(true));
}
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void supportsXmlBasedMediaType() {
assertThat(converter.canRead(Customer.class, MediaType.APPLICATION_ATOM_XML), is(true));
}
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void doesNotSupportUnannotatedInterface() {
assertThat(converter.canRead(UnannotatedInterface.class, MediaType.APPLICATION_XML), is(false));
}
/**
* @see DATACMNS-885
*/
@Test
@Test // DATACMNS-885
public void supportsInterfaceAfterLookupForDifferrentMediaType() {
assertThat(converter.canRead(Customer.class, MediaType.APPLICATION_JSON), is(false));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2015 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,6 @@ import org.springframework.web.util.UriComponentsBuilder;
* Integration tests for {@link EnableSpringDataWebSupport}.
*
* @author Oliver Gierke
* @see DATACMNS-330
*/
public class EnableSpringDataWebSupportIntegrationTests {
@@ -75,7 +74,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
reEnable(JACKSON);
}
@Test
@Test // DATACMNS-330
public void registersBasicBeanDefinitions() throws Exception {
ApplicationContext context = WebTestUtils.createApplicationContext(SampleConfig.class);
@@ -87,7 +86,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
PageableHandlerMethodArgumentResolver.class);
}
@Test
@Test // DATACMNS-330
public void registersHateoasSpecificBeanDefinitions() throws Exception {
ApplicationContext context = WebTestUtils.createApplicationContext(SampleConfig.class);
@@ -97,7 +96,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
assertResolversRegistered(context, PagedResourcesAssemblerArgumentResolver.class);
}
@Test
@Test // DATACMNS-330
public void doesNotRegisterHateoasSpecificComponentsIfHateoasNotPresent() throws Exception {
hide(HATEOAS);
@@ -109,10 +108,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
assertThat(names, not(hasItems("pagedResourcesAssembler", "pagedResourcesAssemblerArgumentResolver")));
}
/**
* @see DATACMNS-475
*/
@Test
@Test // DATACMNS-475
public void registersJacksonSpecificBeanDefinitions() throws Exception {
ApplicationContext context = WebTestUtils.createApplicationContext(SampleConfig.class);
@@ -121,10 +117,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
assertThat(names, hasItem("jacksonGeoModule"));
}
/**
* @see DATACMNS-475
*/
@Test
@Test // DATACMNS-475
public void doesNotRegisterJacksonSpecificComponentsIfJacksonNotPresent() throws Exception {
hide(JACKSON);
@@ -135,10 +128,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
assertThat(names, not(hasItem("jacksonGeoModule")));
}
/**
* @see DATACMNS-626
*/
@Test
@Test // DATACMNS-626
public void registersFormatters() {
ApplicationContext context = WebTestUtils.createApplicationContext(SampleConfig.class);
@@ -151,10 +141,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
assertThat(conversionService.canConvert(Point.class, String.class), is(true));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void createsProxyForInterfaceBasedControllerMethodParameter() throws Exception {
WebApplicationContext applicationContext = WebTestUtils.createApplicationContext(SampleConfig.class);
@@ -172,10 +159,7 @@ public class EnableSpringDataWebSupportIntegrationTests {
andExpect(status().isOk());
}
/**
* @see DATACMNS-660
*/
@Test
@Test // DATACMNS-660
public void picksUpWebConfigurationMixins() {
ApplicationContext context = WebTestUtils.createApplicationContext(SampleConfig.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,10 +80,7 @@ public class PageableResourcesAssemblerIntegrationTests {
assertThat(resources.getLink(Link.REL_SELF), is(notNullValue()));
}
/**
* @see DATACMNS-471
*/
@Test
@Test // DATACMNS-471
public void setsUpPagedResourcesAssemblerFromManualXmlConfig() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("manual.xml", getClass());
@@ -91,10 +88,7 @@ public class PageableResourcesAssemblerIntegrationTests {
context.close();
}
/**
* @see DATACMNS-471
*/
@Test
@Test // DATACMNS-471
public void setsUpPagedResourcesAssemblerFromJavaConfigXmlConfig() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("via-config-class.xml", getClass());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,10 +35,7 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
*/
public class SpringDataWebConfigurationUnitTests {
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void shouldNotAddQuerydslPredicateArgumentResolverWhenQuerydslNotPresent() throws ClassNotFoundException,
InstantiationException, IllegalAccessException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,44 +71,29 @@ public class QuerydslPredicateArgumentResolverUnitTests {
request = new MockHttpServletRequest();
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void supportsParameterReturnsTrueWhenMethodParameterIsPredicateAndAnnotatedCorrectly() {
assertThat(resolver.supportsParameter(getMethodParameterFor("simpleFind", Predicate.class)), is(true));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void supportsParameterReturnsTrueWhenMethodParameterIsPredicateButNotAnnotatedAsSuch() {
assertThat(resolver.supportsParameter(getMethodParameterFor("predicateWithoutAnnotation", Predicate.class)),
is(true));
}
/**
* @see DATACMNS-669
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
public void supportsParameterShouldThrowExceptionWhenMethodParameterIsNoPredicateButAnnotatedAsSuch() {
resolver.supportsParameter(getMethodParameterFor("nonPredicateWithAnnotation", String.class));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void supportsParameterReturnsFalseWhenMethodParameterIsNoPredicate() {
assertThat(resolver.supportsParameter(getMethodParameterFor("nonPredicateWithoutAnnotation", String.class)),
is(false));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void resolveArgumentShouldCreateSingleStringParameterPredicateCorrectly() throws Exception {
request.addParameter("firstname", "rand");
@@ -119,10 +104,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate, is((Predicate) QUser.user.firstname.eq("rand")));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void resolveArgumentShouldCreateMultipleParametersPredicateCorrectly() throws Exception {
request.addParameter("firstname", "rand");
@@ -134,10 +116,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate, is((Predicate) QUser.user.firstname.eq("rand").and(QUser.user.lastname.eq("al'thor"))));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void resolveArgumentShouldCreateNestedObjectPredicateCorrectly() throws Exception {
request.addParameter("address.city", "two rivers");
@@ -150,10 +129,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate, is((Predicate) eq));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void resolveArgumentShouldResolveTypePropertyFromPageCorrectly() throws Exception {
request.addParameter("address.city", "tar valon");
@@ -164,10 +140,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate, is((Predicate) QUser.user.address.city.eq("tar valon")));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void resolveArgumentShouldHonorCustomSpecification() throws Exception {
request.addParameter("firstname", "egwene");
@@ -180,10 +153,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
.and(QUser.user.lastname.toLowerCase().eq("al'vere"))));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void shouldCreatePredicateForNonStringPropertyCorrectly() throws Exception {
request.addParameter("inceptionYear", "978");
@@ -194,10 +164,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate, is((Predicate) QUser.user.inceptionYear.eq(978L)));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void shouldCreatePredicateForNonStringListPropertyCorrectly() throws Exception {
request.addParameter("inceptionYear", new String[] { "978", "998" });
@@ -208,10 +175,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate, is((Predicate) QUser.user.inceptionYear.in(978L, 998L)));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
public void shouldExcludePropertiesCorrectly() throws Exception {
request.addParameter("address.street", "downhill");
@@ -223,10 +187,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(predicate.toString(), is(QUser.user.inceptionYear.eq(973L).toString()));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
@SuppressWarnings("rawtypes")
public void extractTypeInformationShouldUseTypeExtractedFromMethodReturnTypeIfPredicateNotAnnotated() {
@@ -236,10 +197,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
assertThat(type, is((TypeInformation) ClassTypeInformation.from(User.class)));
}
/**
* @see DATACMNS-669
*/
@Test
@Test // DATACMNS-669
@SuppressWarnings("rawtypes")
public void detectsDomainTypesCorrectly() {