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 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.
@@ -31,10 +31,7 @@ import org.junit.Test;
*/
public class DefaultProjectionInformationUnitTests {
/**
* @see DATACMNS-89
*/
@Test
@Test // DATACMNS-89
public void discoversInputProperties() {
ProjectionInformation information = new DefaultProjectionInformation(CustomerProjection.class);
@@ -42,10 +39,7 @@ public class DefaultProjectionInformationUnitTests {
assertThat(toNames(information.getInputProperties()), contains("firstname", "lastname"));
}
/**
* @see DATACMNS-89
*/
@Test
@Test // DATACMNS-89
public void discoversAllInputProperties() {
ProjectionInformation information = new DefaultProjectionInformation(ExtendedProjection.class);
@@ -53,10 +47,7 @@ public class DefaultProjectionInformationUnitTests {
assertThat(toNames(information.getInputProperties()), hasItems("age", "firstname", "lastname"));
}
/**
* @see DATACMNS-967
*/
@Test
@Test // DATACMNS-967
public void doesNotConsiderDefaultMethodInputProperties() throws Exception {
ProjectionInformation information = new DefaultProjectionInformation(WithDefaultMethod.class);

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.
@@ -39,18 +39,12 @@ public class MapAccessingMethodInterceptorUnitTests {
@Mock MethodInvocation invocation;
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
public void rejectsNullMap() {
new MapAccessingMethodInterceptor(null);
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void forwardsObjectMethodsToBackingMap() throws Throwable {
Map<String, Object> map = Collections.emptyMap();
@@ -64,10 +58,7 @@ public class MapAccessingMethodInterceptorUnitTests {
assertThat(result, is((Object) map.toString()));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void setterInvocationStoresValueInMap() throws Throwable {
Map<String, Object> map = new HashMap<String, Object>();
@@ -81,10 +72,7 @@ public class MapAccessingMethodInterceptorUnitTests {
assertThat(map.get("name"), is((Object) "Foo"));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void getterInvocationReturnsValueFromMap() throws Throwable {
Map<String, Object> map = new HashMap<String, Object>();
@@ -97,10 +85,7 @@ public class MapAccessingMethodInterceptorUnitTests {
assertThat(result, is((Object) "Foo"));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void getterReturnsNullIfMapDoesNotContainValue() throws Throwable {
Map<String, Object> map = new HashMap<String, Object>();
@@ -110,10 +95,7 @@ public class MapAccessingMethodInterceptorUnitTests {
assertThat(new MapAccessingMethodInterceptor(map).invoke(invocation), is(nullValue()));
}
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
public void rejectsNonAccessorInvocation() throws Throwable {
when(invocation.getMethod()).thenReturn(Sample.class.getMethod("someMethod"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 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.
@@ -49,10 +49,7 @@ public class ProjectingMethodInterceptorUnitTests {
@Mock MethodInvocation invocation;
@Mock ProjectionFactory factory;
/**
* @see DATAREST-221
*/
@Test
@Test // DATAREST-221
public void wrapsDelegateResultInProxyIfTypesDontMatch() throws Throwable {
MethodInterceptor methodInterceptor = new ProjectingMethodInterceptor(new ProxyProjectionFactory(), interceptor);
@@ -63,10 +60,7 @@ public class ProjectingMethodInterceptorUnitTests {
assertThat(methodInterceptor.invoke(invocation), is(instanceOf(Helper.class)));
}
/**
* @see DATAREST-221
*/
@Test
@Test // DATAREST-221
public void retunsDelegateResultAsIsIfTypesMatch() throws Throwable {
MethodInterceptor methodInterceptor = new ProjectingMethodInterceptor(factory, interceptor);
@@ -77,10 +71,7 @@ public class ProjectingMethodInterceptorUnitTests {
assertThat(methodInterceptor.invoke(invocation), is((Object) "Foo"));
}
/**
* @see DATAREST-221
*/
@Test
@Test // DATAREST-221
public void returnsNullAsIs() throws Throwable {
MethodInterceptor methodInterceptor = new ProjectingMethodInterceptor(factory, interceptor);
@@ -90,10 +81,7 @@ public class ProjectingMethodInterceptorUnitTests {
assertThat(methodInterceptor.invoke(invocation), is(nullValue()));
}
/**
* @see DATAREST-221
*/
@Test
@Test // DATAREST-221
public void considersPrimitivesAsWrappers() throws Throwable {
MethodInterceptor methodInterceptor = new ProjectingMethodInterceptor(factory, interceptor);
@@ -105,10 +93,7 @@ public class ProjectingMethodInterceptorUnitTests {
verify(factory, times(0)).createProjection((Class<?>) anyObject(), anyObject());
}
/**
* @see DATAREST-394, DATAREST-408
*/
@Test
@Test // DATAREST-394, DATAREST-408
@SuppressWarnings("unchecked")
public void appliesProjectionToNonEmptySets() throws Throwable {
@@ -123,10 +108,7 @@ public class ProjectingMethodInterceptorUnitTests {
assertThat(projections, hasItem(instanceOf(HelperProjection.class)));
}
/**
* @see DATAREST-394, DATAREST-408
*/
@Test
@Test // DATAREST-394, DATAREST-408
@SuppressWarnings("unchecked")
public void appliesProjectionToNonEmptyLists() throws Throwable {
@@ -142,10 +124,7 @@ public class ProjectingMethodInterceptorUnitTests {
assertThat(projections, hasItem(instanceOf(HelperProjection.class)));
}
/**
* @see DATAREST-394, DATAREST-408
*/
@Test
@Test // DATAREST-394, DATAREST-408
@SuppressWarnings("unchecked")
public void allowsMaskingAnArrayIntoACollection() throws Throwable {
@@ -160,10 +139,7 @@ public class ProjectingMethodInterceptorUnitTests {
assertThat(projections, hasItem(instanceOf(HelperProjection.class)));
}
/**
* @see DATAREST-394, DATAREST-408
*/
@Test
@Test // DATAREST-394, DATAREST-408
@SuppressWarnings("unchecked")
public void appliesProjectionToNonEmptyMap() throws Throwable {

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.
@@ -34,10 +34,7 @@ import com.jayway.jsonpath.ParseContext;
*/
public class ProjectionIntegrationTests {
/**
* @see DATACMNS-909
*/
@Test
@Test // DATACMNS-909
public void jacksonSerializationDoesNotExposeDecoratedClass() throws Exception {
ProxyProjectionFactory factory = new ProxyProjectionFactory();

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 PropertyAccessingMethodInterceptorUnitTests {
@Mock MethodInvocation invocation;
/**
* @see DATAREST-221
*/
@Test
@Test // DATAREST-221
public void triggersPropertyAccessOnTarget() throws Throwable {
Source source = new Source();
@@ -54,20 +51,14 @@ public class PropertyAccessingMethodInterceptorUnitTests {
assertThat(interceptor.invoke(invocation), is((Object) "Dave"));
}
/**
* @see DATAREST-221
*/
@Test(expected = NotReadablePropertyException.class)
@Test(expected = NotReadablePropertyException.class) // DATAREST-221
public void throwsAppropriateExceptionIfThePropertyCannotBeFound() throws Throwable {
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("getLastname"));
new PropertyAccessingMethodInterceptor(new Source()).invoke(invocation);
}
/**
* @see DATAREST-221
*/
@Test
@Test // DATAREST-221
public void forwardsObjectMethodInvocation() throws Throwable {
when(invocation.getMethod()).thenReturn(Object.class.getMethod("toString"));
@@ -75,10 +66,7 @@ public class PropertyAccessingMethodInterceptorUnitTests {
new PropertyAccessingMethodInterceptor(new Source()).invoke(invocation);
}
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalStateException.class)
@Test(expected = IllegalStateException.class) // DATACMNS-630
public void rejectsNonAccessorMethod() throws Throwable {
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("someGarbage"));
@@ -86,10 +74,7 @@ public class PropertyAccessingMethodInterceptorUnitTests {
new PropertyAccessingMethodInterceptor(new Source()).invoke(invocation);
}
/**
* @see DATACMNS-820
*/
@Test
@Test // DATACMNS-820
public void triggersWritePropertyAccessOnTarget() throws Throwable {
Source source = new Source();
@@ -103,10 +88,7 @@ public class PropertyAccessingMethodInterceptorUnitTests {
assertThat(source.firstname, is((Object) "Carl"));
}
/**
* @see DATACMNS-820
*/
@Test(expected = IllegalStateException.class)
@Test(expected = IllegalStateException.class) // DATACMNS-820
public void throwsAppropriateExceptionIfTheInvocationHasNoArguments() throws Throwable {
Source source = new Source();
@@ -117,10 +99,7 @@ public class PropertyAccessingMethodInterceptorUnitTests {
new PropertyAccessingMethodInterceptor(source).invoke(invocation);
}
/**
* @see DATACMNS-820
*/
@Test(expected = NotWritablePropertyException.class)
@Test(expected = NotWritablePropertyException.class) // DATACMNS-820
public void throwsAppropriateExceptionIfThePropertyCannotWritten() throws Throwable {
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("setGarbage", String.class));

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.
@@ -40,42 +40,27 @@ public class ProxyProjectionFactoryUnitTests {
ProjectionFactory factory = new ProxyProjectionFactory();
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
public void rejectsNullProjectionType() {
factory.createProjection(null);
}
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
public void rejectsNullProjectionTypeWithSource() {
factory.createProjection(null, new Object());
}
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
public void rejectsNullProjectionTypeForInputProperties() {
factory.getInputProperties(null);
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void returnsNullForNullSource() {
assertThat(factory.createProjection(CustomerExcerpt.class, null), is(nullValue()));
}
/**
* @see DATAREST-221, DATACMNS-630
*/
@Test
@Test // DATAREST-221, DATACMNS-630
public void createsProjectingProxy() {
Customer customer = new Customer();
@@ -92,10 +77,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(excerpt.getAddress().getZipCode(), is("ZIP"));
}
/**
* @see DATAREST-221, DATACMNS-630
*/
@Test
@Test // DATAREST-221, DATACMNS-630
@SuppressWarnings("rawtypes")
public void proxyExposesTargetClassAware() {
@@ -105,18 +87,12 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(((TargetClassAware) proxy).getTargetClass(), is(equalTo((Class) HashMap.class)));
}
/**
* @see DATAREST-221, DATACMNS-630
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAREST-221, DATACMNS-630
public void rejectsNonInterfacesAsProjectionTarget() {
factory.createProjection(Object.class, new Object());
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void createsMapBasedProxyFromSource() {
HashMap<String, Object> addressSource = new HashMap<String, Object>();
@@ -137,10 +113,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(address.getZipCode(), is("ZIP"));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void createsEmptyMapBasedProxy() {
CustomerProxy proxy = factory.createProjection(CustomerProxy.class);
@@ -151,10 +124,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(proxy.getFirstname(), is("Dave"));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void returnsAllPropertiesAsInputProperties() {
ProjectionInformation projectionInformation = factory.getProjectionInformation(CustomerExcerpt.class);
@@ -163,10 +133,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(result, hasSize(6));
}
/**
* @see DATACMNS-655
*/
@Test
@Test // DATACMNS-655
public void invokesDefaultMethodOnProxy() {
CustomerExcerpt excerpt = factory.createProjection(CustomerExcerpt.class);
@@ -178,10 +145,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(advisors[0].getAdvice(), is(instanceOf(DefaultMethodInvokingMethodInterceptor.class)));
}
/**
* @see DATACMNS-648
*/
@Test
@Test // DATACMNS-648
public void exposesProxyTarget() {
CustomerExcerpt excerpt = factory.createProjection(CustomerExcerpt.class);
@@ -190,10 +154,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(((TargetAware) excerpt).getTarget(), is(instanceOf(Map.class)));
}
/**
* @see DATACMNS-722
*/
@Test
@Test // DATACMNS-722
public void doesNotProjectPrimitiveArray() {
Customer customer = new Customer();
@@ -204,10 +165,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(excerpt.getPicture(), is(customer.picture));
}
/**
* @see DATACMNS-722
*/
@Test
@Test // DATACMNS-722
public void projectsNonPrimitiveArray() {
Address address = new Address();
@@ -222,10 +180,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(excerpt.getShippingAddresses(), is(arrayWithSize(1)));
}
/**
* @see DATACMNS-782
*/
@Test
@Test // DATACMNS-782
public void convertsPrimitiveValues() {
Customer customer = new Customer();
@@ -236,10 +191,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(excerpt.getId(), is(customer.id.toString()));
}
/**
* @see DATACMNS-89
*/
@Test
@Test // DATACMNS-89
public void exposesProjectionInformationCorrectly() {
ProjectionInformation information = factory.getProjectionInformation(CustomerExcerpt.class);
@@ -248,10 +200,7 @@ public class ProxyProjectionFactoryUnitTests {
assertThat(information.isClosed(), is(true));
}
/**
* @see DATACMNS-829
*/
@Test
@Test // DATACMNS-829
public void projectsMapOfStringToObjectCorrectly() {
Customer customer = new Customer();

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.
@@ -45,10 +45,7 @@ public class SpelAwareProxyProjectionFactoryUnitTests {
factory = new SpelAwareProxyProjectionFactory();
}
/**
* @see DATAREST-221, DATACMNS-630
*/
@Test
@Test // DATAREST-221, DATACMNS-630
public void exposesSpelInvokingMethod() {
Customer customer = new Customer();
@@ -59,10 +56,7 @@ public class SpelAwareProxyProjectionFactoryUnitTests {
assertThat(excerpt.getFullName(), is("Dave Matthews"));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void excludesAtValueAnnotatedMethodsForInputProperties() {
List<String> properties = factory.getInputProperties(CustomerExcerpt.class);
@@ -71,10 +65,7 @@ public class SpelAwareProxyProjectionFactoryUnitTests {
assertThat(properties, hasItem("firstname"));
}
/**
* @see DATACMNS-89
*/
@Test
@Test // DATACMNS-89
public void considersProjectionUsingAtValueNotClosed() {
ProjectionInformation information = factory.getProjectionInformation(CustomerExcerpt.class);
@@ -82,10 +73,7 @@ public class SpelAwareProxyProjectionFactoryUnitTests {
assertThat(information.isClosed(), is(false));
}
/**
* @see DATACMNS-820
*/
@Test
@Test // DATACMNS-820
public void setsValueUsingProjection() {
Customer customer = new Customer();
@@ -97,10 +85,7 @@ public class SpelAwareProxyProjectionFactoryUnitTests {
assertThat(customer.firstname, is("Carl"));
}
/**
* @see DATACMNS-820
*/
@Test
@Test // DATACMNS-820
public void settingNotWriteablePropertyFails() {
Customer customer = new Customer();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2105 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.
@@ -46,10 +46,7 @@ public class SpelEvaluatingMethodInterceptorUnitTests {
SpelExpressionParser parser = new SpelExpressionParser();
/**
* @see DATAREST-221, DATACMNS-630
*/
@Test
@Test // DATAREST-221, DATACMNS-630
public void invokesMethodOnTarget() throws Throwable {
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("propertyFromTarget"));
@@ -60,10 +57,7 @@ public class SpelEvaluatingMethodInterceptorUnitTests {
assertThat(interceptor.invoke(invocation), is((Object) "property"));
}
/**
* @see DATAREST-221, DATACMNS-630
*/
@Test
@Test // DATAREST-221, DATACMNS-630
public void invokesMethodOnBean() throws Throwable {
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("invokeBean"));
@@ -77,10 +71,7 @@ public class SpelEvaluatingMethodInterceptorUnitTests {
assertThat(interceptor.invoke(invocation), is((Object) "value"));
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void forwardNonAtValueAnnotatedMethodToDelegate() throws Throwable {
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("getName"));
@@ -93,10 +84,7 @@ public class SpelEvaluatingMethodInterceptorUnitTests {
verify(delegate).invoke(invocation);
}
/**
* @see DATACMNS-630
*/
@Test(expected = IllegalStateException.class)
@Test(expected = IllegalStateException.class) // DATACMNS-630
public void rejectsEmptySpelExpression() throws Throwable {
when(invocation.getMethod()).thenReturn(InvalidProjection.class.getMethod("getAddress"));
@@ -107,10 +95,7 @@ public class SpelEvaluatingMethodInterceptorUnitTests {
interceptor.invoke(invocation);
}
/**
* @see DATACMNS-630
*/
@Test
@Test // DATACMNS-630
public void allowsMapAccessViaPropertyExpression() throws Throwable {
Map<String, Object> map = new HashMap<String, Object>();