DATAREST-978 - Migrate ticket references in test code to Spring Framework style.

This commit is contained in:
Mark Paluch
2017-01-13 10:07:39 +01:00
parent 992512cf96
commit 6bb989018c
99 changed files with 518 additions and 1777 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-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.
@@ -29,13 +29,9 @@ public interface ProfileRepository extends PagingAndSortingRepository<Profile, S
List<Profile> findByType(String type);
/**
* @see DATAREST-247
*/
// DATAREST-247
long countByType(@Param("type") String type);
/**
* @see DATAREST-511
*/
// DATAREST-511
Optional<Profile> findById(@Param("id") String id);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -25,7 +25,6 @@ import org.springframework.data.mongodb.core.mapping.Document;
*
* @author Greg Turnquist
* @author Oliver Gierke
* @see DATAREST-754
*/
@Document
public class SimulatedGroovyDomainClass implements GroovyObject {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-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.
@@ -21,6 +21,5 @@ import org.springframework.data.repository.CrudRepository;
* Simulates a repository built on a Groovy domain object.
*
* @author Greg Turnquist
* @see DATAREST-754
*/
public interface SimulatedGroovyDomainClassRepository extends CrudRepository<SimulatedGroovyDomainClass, String> {}

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.
@@ -126,10 +126,7 @@ public class MongoWebTests extends CommonWebTests {
andExpect(jsonPath("$.address.zipCode").value(is(notNullValue())));
}
/**
* @see DATAREST-247
*/
@Test
@Test // DATAREST-247
public void executeQueryMethodWithPrimitiveReturnType() throws Exception {
Link profiles = client.discoverUnique("profiles");
@@ -172,10 +169,7 @@ public class MongoWebTests extends CommonWebTests {
assertThat(JsonPath.read(response.getContentAsString(), "$.address.zipCode"), is((Object) "ZIP"));
}
/**
* @see DATAREST-160
*/
@Test
@Test // DATAREST-160
public void returnConflictWhenConcurrentlyEditingVersionedEntity() throws Exception {
Link receiptLink = client.discoverUnique("receipts");
@@ -202,10 +196,7 @@ public class MongoWebTests extends CommonWebTests {
.andExpect(status().isPreconditionFailed());
}
/**
* @see DATAREST-471
*/
@Test
@Test // DATAREST-471
public void auditableResourceHasLastModifiedHeaderSet() throws Exception {
Profile profile = repository.findAll().iterator().next();
@@ -216,10 +207,7 @@ public class MongoWebTests extends CommonWebTests {
assertThat(header, not(isEmptyOrNullString()));
}
/**
* @see DATAREST-482
*/
@Test
@Test // DATAREST-482
public void putDoesNotRemoveAssociations() throws Exception {
Link usersLink = client.discoverUnique("users");
@@ -242,10 +230,7 @@ public class MongoWebTests extends CommonWebTests {
andExpect(jsonPath("$.embedded.users[0].address").doesNotExist());
}
/**
* @see DATAREST-482
*/
@Test
@Test // DATAREST-482
public void emptiesAssociationForEmptyUriList() throws Exception {
Link usersLink = client.discoverUnique("users");
@@ -259,10 +244,7 @@ public class MongoWebTests extends CommonWebTests {
andExpect(jsonPath("$").exists());
}
/**
* @see DATAREST-491
*/
@Test
@Test // DATAREST-491
public void updatesMapPropertyCorrectly() throws Exception {
Link profilesLink = client.discoverUnique("profiles");
@@ -276,10 +258,7 @@ public class MongoWebTests extends CommonWebTests {
client.follow(profileLink).andExpect(jsonPath("$.metadata.Key").value("Value"));
}
/**
* @see DATAREST-506
*/
@Test
@Test // DATAREST-506
public void supportsConditionalGetsOnItemResource() throws Exception {
Receipt receipt = new Receipt();
@@ -302,10 +281,7 @@ public class MongoWebTests extends CommonWebTests {
andExpect(header().string(ETAG, is(notNullValue())));
}
/**
* @see DATAREST-511
*/
@Test
@Test // DATAREST-511
public void invokesQueryResourceReturningAnOptional() throws Exception {
Profile profile = repository.findAll().iterator().next();
@@ -316,10 +292,7 @@ public class MongoWebTests extends CommonWebTests {
andExpect(status().isOk());
}
/**
* @see DATAREST-517
*/
@Test
@Test // DATAREST-517
public void returnsNotFoundIfQueryExecutionDoesNotReturnResult() throws Exception {
Link link = client.discoverUnique("profiles", "search", "findById");
@@ -328,10 +301,7 @@ public class MongoWebTests extends CommonWebTests {
andExpect(status().isNotFound());
}
/**
* @see DATAREST-712
*/
@Test
@Test // DATAREST-712
public void invokesQueryMethodTakingAReferenceCorrectly() throws Exception {
Link link = client.discoverUnique("users", "search", "findByColleaguesContains");
@@ -344,10 +314,7 @@ public class MongoWebTests extends CommonWebTests {
mvc.perform(get(href)).andExpect(status().isOk());
}
/**
* @see DATAREST-835
*/
@Test
@Test // DATAREST-835
public void exposesETagHeaderForSearchResourceYieldingItemResource() throws Exception {
Link link = client.discoverUnique("profiles", "search", "findById");
@@ -359,10 +326,7 @@ public class MongoWebTests extends CommonWebTests {
.andExpect(header().string("Last-Modified", is(notNullValue())));
}
/**
* @see DATAREST-835
*/
@Test
@Test // DATAREST-835
public void doesNotAddETagHeaderForCollectionQueryResource() throws Exception {
Link link = client.discoverUnique("profiles", "search", "findByType");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 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.
@@ -57,10 +57,7 @@ public class PersistentEntityResourceAssemblerIntegrationTests extends AbstractC
@Autowired @Qualifier("objectMapper") ObjectMapper objectMapper;
@Autowired Associations associations;
/**
* @see DATAREST-609
*/
@Test
@Test // DATAREST-609
public void addsSelfAndSingleResourceLinkToResourceByDefault() throws Exception {
Projector projector = mock(Projector.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 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.
@@ -39,10 +39,7 @@ public class RepositoryRestHandlerMappingIntegrationTests extends AbstractContro
@Autowired DelegatingHandlerMapping mapping;
/**
* @see DATAREST-617
*/
@Test
@Test // DATAREST-617
public void usesMethodsWithoutProducesClauseForGeneralJsonRequests() throws Exception {
MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", "/users");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 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.
@@ -79,10 +79,7 @@ public class JsonPatchHandlerUnitTests {
this.user.address = address;
}
/**
* @see DATAREST-348
*/
@Test
@Test // DATAREST-348
public void appliesRemoveOperationCorrectly() throws Exception {
String input = "[{ \"op\": \"replace\", \"path\": \"/address/zipCode\", \"value\": \"ZIP\" },"
@@ -94,10 +91,7 @@ public class JsonPatchHandlerUnitTests {
assertThat(result.address.zipCode, is("ZIP"));
}
/**
* @see DATAREST-348
*/
@Test
@Test // DATAREST-348
public void appliesMergePatchCorrectly() throws Exception {
String input = "{ \"address\" : { \"zipCode\" : \"ZIP\"}, \"lastname\" : null }";
@@ -130,10 +124,7 @@ public class JsonPatchHandlerUnitTests {
assertThat(user.colleagues.get(0).firstname, is(christoph.firstname));
}
/**
* @see DATAREST-609
*/
@Test
@Test // DATAREST-609
public void hintsToMediaTypeIfBodyCantBeRead() throws Exception {
exception.expect(HttpMessageNotReadableException.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.
@@ -48,10 +48,7 @@ public class LegacyRepresentationConfigIntegrationTests extends AbstractReposito
}
}
/**
* @see DATAREST-213, DATAREST-617
*/
@Test
@Test // DATAREST-213, DATAREST-617
public void returnsJsonIfConfiguredAndRequested() throws Exception {
for (String resource : Arrays.asList("/", "/users")) {
@@ -61,10 +58,7 @@ public class LegacyRepresentationConfigIntegrationTests extends AbstractReposito
}
}
/**
* @see DATAREST-213, DATAREST-617
*/
@Test
@Test // DATAREST-213, DATAREST-617
public void returnsJsonIfConfigured() throws Exception {
for (String resource : Arrays.asList("/", "/users")) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 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.
@@ -80,10 +80,7 @@ public class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUn
when(parameter.hasParameterAnnotation(QuerydslPredicate.class)).thenReturn(true);
}
/**
* @see DATAREST-616
*/
@Test
@Test // DATAREST-616
public void returnsInvokerIfRepositoryIsNotQuerydslAware() {
ReceiptRepository repository = mock(ReceiptRepository.class);
@@ -94,10 +91,7 @@ public class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUn
assertThat(result, is(invoker));
}
/**
* @see DATAREST-616
*/
@Test
@Test // DATAREST-616
public void wrapsInvokerInQuerydslAdapter() {
Object repository = mock(QuerydslUserRepository.class);
@@ -108,10 +102,7 @@ public class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUn
assertThat(result, is(instanceOf(QuerydslRepositoryInvokerAdapter.class)));
}
/**
* @see DATAREST-616
*/
@Test
@Test // DATAREST-616
public void invokesCustomizationOnRepositoryIfItImplementsCustomizer() {
QuerydslCustomizingUserRepository repository = mock(QuerydslCustomizingUserRepository.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-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.
@@ -96,10 +96,7 @@ public class PersistentEntitySerializationTests {
this.projectionFactory = new SpelAwareProxyProjectionFactory();
}
/**
* @see DATAREST-250
*/
@Test
@Test // DATAREST-250
public void serializesEmbeddedReferencesCorrectly() throws Exception {
User user = new User();
@@ -119,18 +116,12 @@ public class PersistentEntitySerializationTests {
assertThat(JsonPath.read(result, "$._embedded.users[*].address"), is(notNullValue()));
}
/**
* @see DATAREST-654
*/
@Test
@Test // DATAREST-654
public void deserializesTranslatedEnumProperty() throws Exception {
assertThat(mapper.readValue("{ \"gender\" : \"Male\" }", User.class).gender, is(Gender.MALE));
}
/**
* @see DATAREST-864
*/
@Test
@Test // DATAREST-864
public void createsNestedResourceForMap() throws Exception {
User dave = users.save(new User());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 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.
@@ -95,10 +95,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
customizerFactory);
}
/**
* @see DATAREST-631, DATAREST-632
*/
@Test
@Test // DATAREST-631, DATAREST-632
public void fulfillsConstraintsForProfile() {
List<Constraint> constraints = new ArrayList<Constraint>();
@@ -111,10 +108,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
assertConstraints(Profile.class, constraints);
}
/**
* @see DATAREST-632
*/
@Test
@Test // DATAREST-632
public void fulfillsConstraintsForUser() throws Exception {
List<Constraint> constraints = new ArrayList<Constraint>();
@@ -166,10 +160,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
assertConstraints(User.class, constraints);
}
/**
* @see DATAREST-754
*/
@Test
@Test // DATAREST-754
public void handlesGroovyDomainObjects() {
List<Constraint> constraints = new ArrayList<Constraint>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 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.
@@ -39,10 +39,7 @@ public class RepositoryLinkBuildUnitTests {
MongoMappingContext context = new MongoMappingContext();
/**
* @see DATAREST-292
*/
@Test
@Test // DATAREST-292
public void usesCurrentRequestsUriBaseForRelativeBaseUri() {
TestMvcClient.initWebTest();
@@ -50,10 +47,7 @@ public class RepositoryLinkBuildUnitTests {
assertRootUriFor("api", "http://localhost/api/profile");
}
/**
* @see DATAREST-292, DATAREST-296
*/
@Test
@Test // DATAREST-292, DATAREST-296
public void usesBaseUriOnlyIfItIsAbsolute() {
assertRootUriFor("http://foobar/api", "http://foobar/api/profile");
}