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 2011-2012 by the original author(s).
* Copyright 2011-2017 by the original author(s).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,10 +86,7 @@ public class PreferredConstructorDiscovererUnitTests<P extends PersistentPropert
assertThat(parameters.hasNext(), is(false));
}
/**
* @see DATACMNS-134
*/
@Test
@Test // DATACMNS-134
public void discoversInnerClassConstructorCorrectly() {
PersistentEntity<Inner, P> entity = new BasicPersistentEntity<Inner, P>(ClassTypeInformation.from(Inner.class));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-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.
@@ -147,10 +147,7 @@ public class PropertyPathUnitTests {
assertThat(from.getLeafProperty(), is(PropertyPath.from("name", FooBar.class)));
}
/**
* @see DATACMNS-45
*/
@Test
@Test // DATACMNS-45
public void handlesEmptyUnderscoresCorrectly() {
PropertyPath propertyPath = PropertyPath.from("_foo", Sample2.class);
@@ -195,10 +192,7 @@ public class PropertyPathUnitTests {
assertThat(iterator.hasNext(), is(false));
}
/**
* @see DATACMNS-139
*/
@Test
@Test // DATACMNS-139
public void rejectsInvalidPropertyWithLeadingUnderscore() {
try {
PropertyPath.from("_id", Foo.class);
@@ -208,10 +202,7 @@ public class PropertyPathUnitTests {
}
}
/**
* @see DATACMNS-139
*/
@Test
@Test // DATACMNS-139
public void rejectsNestedInvalidPropertyWithLeadingUnderscore() {
try {
PropertyPath.from("_foo_id", Sample2.class);
@@ -221,10 +212,7 @@ public class PropertyPathUnitTests {
}
}
/**
* @see DATACMNS-139
*/
@Test
@Test // DATACMNS-139
public void rejectsNestedInvalidPropertyExplictlySplitWithLeadingUnderscore() {
try {
PropertyPath.from("_foo__id", Sample2.class);
@@ -234,10 +222,7 @@ public class PropertyPathUnitTests {
}
}
/**
* @see DATACMNS 158
*/
@Test(expected = PropertyReferenceException.class)
@Test(expected = PropertyReferenceException.class) // DATACMNS 158
public void rejectsInvalidPathsContainingDigits() {
PropertyPath.from("PropertyThatWillFail4Sure", Foo.class);
}
@@ -281,10 +266,7 @@ public class PropertyPathUnitTests {
assertThat(left.hashCode(), is(not(shortPath.hashCode())));
}
/**
* @see DATACMNS-257
*/
@Test
@Test // DATACMNS-257
public void findsAllUppercaseProperty() {
PropertyPath path = PropertyPath.from("UUID", Foo.class);
@@ -293,10 +275,7 @@ public class PropertyPathUnitTests {
assertThat(path.getSegment(), is("UUID"));
}
/**
* @see DATACMNS-257
*/
@Test
@Test // DATACMNS-257
public void findsNestedAllUppercaseProperty() {
PropertyPath path = PropertyPath.from("_fooUUID", Sample2.class);
@@ -307,10 +286,7 @@ public class PropertyPathUnitTests {
assertThat(path.next().getSegment(), is("UUID"));
}
/**
* @see DATACMNS-381
*/
@Test
@Test // DATACMNS-381
public void exposesPreviouslyReferencedPathInExceptionMessage() {
exception.expect(PropertyReferenceException.class);
@@ -321,42 +297,27 @@ public class PropertyPathUnitTests {
PropertyPath.from("userNameBar", Bar.class);
}
/**
* @see DATACMNS-387
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-387
public void rejectsNullSource() {
from(null, Foo.class);
}
/**
* @see DATACMNS-387
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-387
public void rejectsEmptySource() {
from("", Foo.class);
}
/**
* @see DATACMNS-387
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-387
public void rejectsNullClass() {
from("foo", (Class<?>) null);
}
/**
* @see DATACMNS-387
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-387
public void rejectsNullTypeInformation() {
from("foo", (TypeInformation<?>) null);
}
/**
* @see DATACMNS-546
*/
@Test
@Test // DATACMNS-546
public void returnsCompletePathIfResolutionFailedCompletely() {
exception.expect(PropertyReferenceException.class);
@@ -365,10 +326,7 @@ public class PropertyPathUnitTests {
from("somethingDifferent", Foo.class);
}
/**
* @see DATACMNS-546
*/
@Test
@Test // DATACMNS-546
public void includesResolvedPathInExceptionMessage() {
exception.expect(PropertyReferenceException.class);
@@ -379,10 +337,7 @@ public class PropertyPathUnitTests {
from("userFooName", Bar.class);
}
/**
* @see DATACMNS-703
*/
@Test
@Test // DATACMNS-703
public void includesPropertyHintsOnTypos() {
exception.expect(PropertyReferenceException.class);

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.
@@ -67,10 +67,7 @@ public class PropertyReferenceExceptionUnitTests {
new PropertyReferenceException("nme", TYPE_INFO, null);
}
/**
* @see DATACMNS-801
*/
@Test
@Test // DATACMNS-801
public void exposesPotentialMatch() {
PropertyReferenceException exception = new PropertyReferenceException("nme", TYPE_INFO, NO_PATHS);

View File

@@ -41,10 +41,7 @@ public class SimpleTypeHolderUnitTests {
new SimpleTypeHolder(new HashSet<Class<?>>(), null);
}
/**
* @see DATACMNS-31
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-31
public void rejectsNullTypeForIsSimpleTypeCall() {
SimpleTypeHolder holder = new SimpleTypeHolder();
holder.isSimpleType(null);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 by the original author(s).
* Copyright 2011-2017 by the original author(s).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,10 +40,7 @@ import org.springframework.data.util.TypeInformation;
*/
public class AbstractMappingContextIntegrationTests<T extends PersistentProperty<T>> {
/**
* @see DATACMNS-457
*/
@Test
@Test // DATACMNS-457
public void returnsManagedType() {
SampleMappingContext context = new SampleMappingContext();
@@ -53,10 +50,7 @@ public class AbstractMappingContextIntegrationTests<T extends PersistentProperty
assertThat(context.getManagedTypes(), hasItem(ClassTypeInformation.from(Person.class)));
}
/**
* @see DATACMNS-457
*/
@Test
@Test // DATACMNS-457
public void indicatesManagedType() {
SampleMappingContext context = new SampleMappingContext();
@@ -66,10 +60,7 @@ public class AbstractMappingContextIntegrationTests<T extends PersistentProperty
assertThat(context.hasPersistentEntityFor(Person.class), is(true));
}
/**
* @see DATACMNS-243
*/
@Test
@Test // DATACMNS-243
public void createsPersistentEntityForInterfaceCorrectly() {
SampleMappingContext context = new SampleMappingContext();
@@ -78,10 +69,7 @@ public class AbstractMappingContextIntegrationTests<T extends PersistentProperty
assertThat(entity.getIdProperty(), is(notNullValue()));
}
/**
* @see DATACMNS-65
*/
@Test
@Test // DATACMNS-65
public void foo() throws InterruptedException {
final DummyMappingContext context = new DummyMappingContext();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-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.
@@ -65,10 +65,7 @@ public class AbstractMappingContextUnitTests {
assertThat(path, is(notNullValue()));
}
/**
* @see DATACMNS-92
*/
@Test(expected = MappingException.class)
@Test(expected = MappingException.class) // DATACMNS-92
public void doesNotAddInvalidEntity() {
context = new SampleMappingContext() {
@@ -111,36 +108,24 @@ public class AbstractMappingContextUnitTests {
verify(context, times(1)).publishEvent(Mockito.any(ApplicationEvent.class));
}
/**
* @see DATACMNS-214
*/
@Test
@Test // DATACMNS-214
public void returnsNullPersistentEntityForSimpleTypes() {
SampleMappingContext context = new SampleMappingContext();
assertThat(context.getPersistentEntity(String.class), is(nullValue()));
}
/**
* @see DATACMNS-214
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-214
public void rejectsNullValueForGetPersistentEntityOfClass() {
context.getPersistentEntity((Class<?>) null);
}
/**
* @see DATACMNS-214
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-214
public void rejectsNullValueForGetPersistentEntityOfTypeInformation() {
context.getPersistentEntity((TypeInformation<?>) null);
}
/**
* @see DATACMNS-228
*/
@Test
@Test // DATACMNS-228
public void doesNotCreatePersistentPropertyForGroovyMetaClass() {
SampleMappingContext mappingContext = new SampleMappingContext();
@@ -150,10 +135,7 @@ public class AbstractMappingContextUnitTests {
assertThat(entity.getPersistentProperty("metaClass"), is(nullValue()));
}
/**
* @see DATACMNS-332
*/
@Test
@Test // DATACMNS-332
public void usesMostConcreteProperty() {
SampleMappingContext mappingContext = new SampleMappingContext();
@@ -161,10 +143,7 @@ public class AbstractMappingContextUnitTests {
assertThat(entity.getPersistentProperty("foo").isIdProperty(), is(true));
}
/**
* @see DATACMNS-345
*/
@Test
@Test // DATACMNS-345
@SuppressWarnings("rawtypes")
public void returnsEntityForComponentType() {
@@ -177,10 +156,7 @@ public class AbstractMappingContextUnitTests {
assertThat(propertyEntity.getType(), is(equalTo((Class) Person.class)));
}
/**
* @see DATACMNS-380
*/
@Test
@Test // DATACMNS-380
public void returnsPersistentPropertyPathForDotPath() {
PersistentPropertyPath<SamplePersistentProperty> path = context.getPersistentPropertyPath("persons.name",
@@ -191,18 +167,12 @@ public class AbstractMappingContextUnitTests {
assertThat(path.getLeafProperty().getName(), is("name"));
}
/**
* @see DATACMNS-380
*/
@Test(expected = MappingException.class)
@Test(expected = MappingException.class) // DATACMNS-380
public void rejectsInvalidPropertyReferenceWithMappingException() {
context.getPersistentPropertyPath("foo", Sample.class);
}
/**
* @see DATACMNS-390
*/
@Test
@Test // DATACMNS-390
public void exposesCopyOfPersistentEntitiesToAvoidConcurrentModificationException() {
SampleMappingContext context = new SampleMappingContext();
@@ -217,49 +187,34 @@ public class AbstractMappingContextUnitTests {
}
}
/**
* @see DATACMNS-447
*/
@Test
@Test // DATACMNS-447
public void shouldReturnNullForSimpleTypesIfInStrictIsEnabled() {
context.setStrict(true);
assertThat(context.getPersistentEntity(Integer.class), is(nullValue()));
}
/**
* @see DATACMNS-462
*/
@Test
@Test // DATACMNS-462
public void hasPersistentEntityForCollectionPropertiesAfterInitialization() {
context.getPersistentEntity(Sample.class);
assertHasEntityFor(Person.class, context, true);
}
/**
* @see DATACMNS-479
*/
@Test
@Test // DATACMNS-479
public void doesNotAddMapImplementationClassesAsPersistentEntity() {
context.getPersistentEntity(Sample.class);
assertHasEntityFor(TreeMap.class, context, false);
}
/**
* @see DATACMNS-695
*/
@Test
@Test // DATACMNS-695
public void persistentPropertyPathTraversesGenericTypesCorrectly() {
assertThat(context.getPersistentPropertyPath("field.wrapped.field", Outer.class),
is(Matchers.<SamplePersistentProperty> iterableWithSize(3)));
}
/**
* @see DATACMNS-727
*/
@Test
@Test // DATACMNS-727
public void exposesContextForFailingPropertyPathLookup() {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-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.
@@ -120,10 +120,7 @@ public class DefaultPersistenPropertyPathUnitTests<T extends PersistentProperty<
assertThat(twoLegs.getLength(), is(2));
}
/**
* @see DATACMNS-444
*/
@Test
@Test // DATACMNS-444
public void skipsMappedPropertyNameIfConverterReturnsNull() {
String result = twoLegs.toDotPath(new Converter<T, String>() {
@@ -137,10 +134,7 @@ public class DefaultPersistenPropertyPathUnitTests<T extends PersistentProperty<
assertThat(result, is(nullValue()));
}
/**
* @see DATACMNS-444
*/
@Test
@Test // DATACMNS-444
public void skipsMappedPropertyNameIfConverterReturnsEmptyStrings() {
String result = twoLegs.toDotPath(new Converter<T, String>() {

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.
@@ -39,18 +39,12 @@ public class PersistentEntitiesUnitTests {
@Mock SampleMappingContext first;
@Mock SampleMappingContext second;
/**
* @see DATACMNS-458
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-458
public void rejectsNullMappingContexts() {
new PersistentEntities(null);
}
/**
* @see DATACMNS-458
*/
@Test
@Test // DATACMNS-458
public void returnsPersistentEntitiesFromMappingContexts() {
when(first.hasPersistentEntityFor(Sample.class)).thenReturn(false);
@@ -65,10 +59,7 @@ public class PersistentEntitiesUnitTests {
verify(second, times(1)).getPersistentEntity(Sample.class);
}
/**
* @see DATACMNS-458
*/
@Test
@Test // DATACMNS-458
public void indicatesManagedType() {
SampleMappingContext context = new SampleMappingContext();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-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.
@@ -58,10 +58,7 @@ public class AbstractPersistentPropertyUnitTests {
typeHolder = new SimpleTypeHolder();
}
/**
* @see DATACMNS-68
*/
@Test
@Test // DATACMNS-68
public void discoversComponentTypeCorrectly() throws Exception {
Field field = ReflectionUtils.findField(TestClassComplex.class, "testClassSet");
@@ -70,10 +67,7 @@ public class AbstractPersistentPropertyUnitTests {
property.getComponentType();
}
/**
* @see DATACMNS-101
*/
@Test
@Test // DATACMNS-101
public void returnsNestedEntityTypeCorrectly() {
Field field = ReflectionUtils.findField(TestClassComplex.class, "testClassSet");
@@ -82,10 +76,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getPersistentEntityType().iterator().hasNext(), is(false));
}
/**
* @see DATACMNS-132
*/
@Test
@Test // DATACMNS-132
public void isEntityWorksForUntypedMaps() throws Exception {
Field field = ReflectionUtils.findField(TestClassComplex.class, "map");
@@ -93,10 +84,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.isEntity(), is(false));
}
/**
* @see DATACMNS-132
*/
@Test
@Test // DATACMNS-132
public void isEntityWorksForUntypedCollection() throws Exception {
Field field = ReflectionUtils.findField(TestClassComplex.class, "collection");
@@ -104,10 +92,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.isEntity(), is(false));
}
/**
* @see DATACMNS-121
*/
@Test
@Test // DATACMNS-121
public void considersPropertiesEqualIfFieldEquals() {
Field first = ReflectionUtils.findField(FirstConcrete.class, "genericField");
@@ -120,10 +105,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(firstProperty.hashCode(), is(secondProperty.hashCode()));
}
/**
* @see DATACMNS-180
*/
@Test
@Test // DATACMNS-180
public void doesNotConsiderJavaTransientFieldsTransient() {
Field transientField = ReflectionUtils.findField(TestClassComplex.class, "transientField");
@@ -132,10 +114,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.isTransient(), is(false));
}
/**
* @see DATACMNS-206
*/
@Test
@Test // DATACMNS-206
public void findsSimpleGettersAndASetters() {
Field field = ReflectionUtils.findField(AccessorTestClass.class, "id");
@@ -146,10 +125,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getSetter(), is(notNullValue()));
}
/**
* @see DATACMNS-206
*/
@Test
@Test // DATACMNS-206
public void doesNotUseInvalidGettersAndASetters() {
Field field = ReflectionUtils.findField(AccessorTestClass.class, "anotherId");
@@ -160,10 +136,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getSetter(), is(nullValue()));
}
/**
* @see DATACMNS-206
*/
@Test
@Test // DATACMNS-206
public void usesCustomGetter() {
Field field = ReflectionUtils.findField(AccessorTestClass.class, "yetAnotherId");
@@ -174,10 +147,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getSetter(), is(nullValue()));
}
/**
* @see DATACMNS-206
*/
@Test
@Test // DATACMNS-206
public void usesCustomSetter() {
Field field = ReflectionUtils.findField(AccessorTestClass.class, "yetYetAnotherId");
@@ -188,10 +158,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getSetter(), is(notNullValue()));
}
/**
* @see DATACMNS-206
*/
@Test
@Test // DATACMNS-206
public void returnsNullGetterAndSetterIfNoPropertyDescriptorGiven() {
Field field = ReflectionUtils.findField(AccessorTestClass.class, "id");
@@ -202,10 +169,7 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getSetter(), is(nullValue()));
}
/**
* @see DATACMNS-337
*/
@Test
@Test // DATACMNS-337
public void resolvesActualType() {
SamplePersistentProperty property = getProperty(Sample.class, "person");
@@ -221,50 +185,35 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getActualType(), is((Object) Person.class));
}
/**
* @see DATACMNS-462
*/
@Test
@Test // DATACMNS-462
public void considersCollectionPropertyEntitiesIfComponentTypeIsEntity() {
SamplePersistentProperty property = getProperty(Sample.class, "persons");
assertThat(property.isEntity(), is(true));
}
/**
* @see DATACMNS-462
*/
@Test
@Test // DATACMNS-462
public void considersMapPropertyEntitiesIfValueTypeIsEntity() {
SamplePersistentProperty property = getProperty(Sample.class, "personMap");
assertThat(property.isEntity(), is(true));
}
/**
* @see DATACMNS-462
*/
@Test
@Test // DATACMNS-462
public void considersArrayPropertyEntitiesIfComponentTypeIsEntity() {
SamplePersistentProperty property = getProperty(Sample.class, "personArray");
assertThat(property.isEntity(), is(true));
}
/**
* @see DATACMNS-462
*/
@Test
@Test // DATACMNS-462
public void considersCollectionPropertySimpleIfComponentTypeIsSimple() {
SamplePersistentProperty property = getProperty(Sample.class, "strings");
assertThat(property.isEntity(), is(false));
}
/**
* @see DATACMNS-562
*/
@Test
@Test // DATACMNS-562
public void doesNotConsiderPropertyWithTreeMapMapValueAnEntity() {
SamplePersistentProperty property = getProperty(TreeMapWrapper.class, "map");

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.
@@ -58,44 +58,29 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
entity = context.getPersistentEntity(Sample.class);
}
/**
* @see DATACMNS-269
*/
@Test
@Test // DATACMNS-269
public void discoversAnnotationOnField() {
assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("field"));
}
/**
* @see DATACMNS-269
*/
@Test
@Test // DATACMNS-269
public void discoversAnnotationOnGetters() {
assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("getter"));
}
/**
* @see DATACMNS-269
*/
@Test
@Test // DATACMNS-269
public void discoversAnnotationOnSetters() {
assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("setter"));
}
/**
* @see DATACMNS-269
*/
@Test
@Test // DATACMNS-269
public void findsMetaAnnotation() {
assertAnnotationPresent(MyId.class, entity.getPersistentProperty("id"));
assertAnnotationPresent(Id.class, entity.getPersistentProperty("id"));
}
/**
* @see DATACMNS-282
*/
@Test
@Test // DATACMNS-282
public void populatesAnnotationCacheWithDirectAnnotationsOnCreation() {
SamplePersistentProperty property = entity.getPersistentProperty("meta");
@@ -111,10 +96,7 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
assertThat(cache.containsKey(MyAnnotation.class), is(true));
}
/**
* @see DATACMNS-282
*/
@Test
@Test // DATACMNS-282
public void discoversAmbiguousMappingUsingDirectAnnotationsOnAccessors() {
try {
@@ -125,90 +107,57 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
}
}
/**
* @see DATACMNS-243
*/
@Test
@Test // DATACMNS-243
public void defaultsToFieldAccess() {
assertThat(getProperty(FieldAccess.class, "name").usePropertyAccess(), is(false));
}
/**
* @see DATACMNS-243
*/
@Test
@Test // DATACMNS-243
public void usesAccessTypeDeclaredOnTypeAsDefault() {
assertThat(getProperty(PropertyAccess.class, "firstname").usePropertyAccess(), is(true));
}
/**
* @see DATACMNS-243
*/
@Test
@Test // DATACMNS-243
public void propertyAnnotationOverridesTypeConfiguration() {
assertThat(getProperty(PropertyAccess.class, "lastname").usePropertyAccess(), is(false));
}
/**
* @see DATACMNS-243
*/
@Test
@Test // DATACMNS-243
public void fieldAnnotationOverridesTypeConfiguration() {
assertThat(getProperty(PropertyAccess.class, "emailAddress").usePropertyAccess(), is(false));
}
/**
* @see DATACMNS-243
*/
@Test
@Test // DATACMNS-243
public void doesNotRejectSameAnnotationIfItsEqualOnBothFieldAndAccessor() {
context.getPersistentEntity(AnotherInvalidSample.class);
}
/**
* @see DATACMNS-534
*/
@Test
@Test // DATACMNS-534
public void treatsNoAnnotationCorrectly() {
assertThat(getProperty(ClassWithReadOnlyProperties.class, "noAnnotations").isWritable(), is(true));
}
/**
* @see DATACMNS-534
*/
@Test
@Test // DATACMNS-534
public void treatsTransientAsNotExisting() {
assertThat(getProperty(ClassWithReadOnlyProperties.class, "transientProperty"), nullValue());
}
/**
* @see DATACMNS-534
*/
@Test
@Test // DATACMNS-534
public void treatsReadOnlyAsNonWritable() {
assertThat(getProperty(ClassWithReadOnlyProperties.class, "readOnlyProperty").isWritable(), is(false));
}
/**
* @see DATACMNS-534
*/
@Test
@Test // DATACMNS-534
public void considersPropertyWithReadOnlyMetaAnnotationReadOnly() {
assertThat(getProperty(ClassWithReadOnlyProperties.class, "customReadOnlyProperty").isWritable(), is(false));
}
/**
* @see DATACMNS-556
*/
@Test
@Test // DATACMNS-556
public void doesNotRejectNonSpringDataAnnotationsUsedOnBothFieldAndAccessor() {
getProperty(TypeWithCustomAnnotationsOnBothFieldAndAccessor.class, "field");
}
/**
* @see DATACMNS-677
*/
@Test
@Test // DATACMNS-677
@SuppressWarnings("unchecked")
public void cachesNonPresenceOfAnnotationOnField() {
@@ -222,10 +171,7 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
assertThat(field.get(MyAnnotation.class), is(nullValue()));
}
/**
* @see DATACMNS-825
*/
@Test
@Test // DATACMNS-825
public void composedAnnotationWithAliasForGetCachedCorrectly() {
SamplePersistentProperty property = entity.getPersistentProperty("metaAliased");
@@ -241,10 +187,7 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
assertThat(cache.containsKey(MyAnnotation.class), is(true));
}
/**
* @see DATACMNS-825
*/
@Test
@Test // DATACMNS-825
public void composedAnnotationWithAliasShouldHaveSynthesizedAttributeValues() {
SamplePersistentProperty property = entity.getPersistentProperty("metaAliased");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-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.
@@ -94,10 +94,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(entity.getTypeAlias(), is((Object) "foo"));
}
/**
* @see DATACMNS-50
*/
@Test
@Test // DATACMNS-50
@SuppressWarnings("unchecked")
public void considersComparatorForPropertyOrder() {
@@ -130,10 +127,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(iterator.next(), is(entity.getPersistentProperty("ssn")));
}
/**
* @see DATACMNS-186
*/
@Test
@Test // DATACMNS-186
public void addingAndIdPropertySetsIdPropertyInternally() {
MutablePersistentEntity<Person, T> entity = createEntity(Person.class);
@@ -144,10 +138,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(entity.getIdProperty(), is(property));
}
/**
* @see DATACMNS-186
*/
@Test
@Test // DATACMNS-186
public void rejectsIdPropertyIfAlreadySet() {
MutablePersistentEntity<Person, T> entity = createEntity(Person.class);
@@ -160,10 +151,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
entity.addPersistentProperty(anotherProperty);
}
/**
* @see DATACMNS-365
*/
@Test
@Test // DATACMNS-365
public void detectsPropertyWithAnnotation() {
SampleMappingContext context = new SampleMappingContext();
@@ -180,10 +168,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(entity.getPersistentProperty(CreatedDate.class), is(nullValue()));
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void returnsBeanWrapperForPropertyAccessor() {
assumeThat(System.getProperty("java.version"), CoreMatchers.startsWith("1.6"));
@@ -198,10 +183,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(accessor.getBean(), is((Object) value));
}
/**
* @see DATACMNS-809
*/
@Test
@Test // DATACMNS-809
public void returnsGeneratedPropertyAccessorForPropertyAccessor() {
assumeThat(System.getProperty("java.version"), not(CoreMatchers.startsWith("1.6")));
@@ -217,10 +199,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(accessor.getBean(), is((Object) value));
}
/**
* @see DATACMNS-596
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-596
public void rejectsNullBeanForPropertyAccessor() {
SampleMappingContext context = new SampleMappingContext();
@@ -229,10 +208,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
entity.getPropertyAccessor(null);
}
/**
* @see DATACMNS-596
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-596
public void rejectsNonMatchingBeanForPropertyAccessor() {
SampleMappingContext context = new SampleMappingContext();
@@ -241,10 +217,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
entity.getPropertyAccessor("foo");
}
/**
* @see DATACMNS-597
*/
@Test
@Test // DATACMNS-597
public void supportsSubtypeInstancesOnPropertyAccessorLookup() {
SampleMappingContext context = new SampleMappingContext();
@@ -253,10 +226,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(entity.getPropertyAccessor(new Subtype()), is(notNullValue()));
}
/**
* @see DATACMNS-825
*/
@Test
@Test // DATACMNS-825
public void returnsTypeAliasIfAnnotatedUsingComposedAnnotation() {
PersistentEntity<AliasEntityUsingComposedAnnotation, T> entity = createEntity(
@@ -264,10 +234,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
assertThat(entity.getTypeAlias(), is((Object) "bar"));
}
/**
* @see DATACMNS-866
*/
@Test
@Test // DATACMNS-866
public void invalidBeanAccessCreatesDescriptiveErrorMessage() {
PersistentEntity<Entity, T> entity = createEntity(Entity.class);
@@ -278,10 +245,7 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
entity.getPropertyAccessor(new Object());
}
/**
* @see DATACMNS-934
*/
@Test
@Test // DATACMNS-934
public void doesNotThrowAnExceptionForNullAssociation() {
BasicPersistentEntity<Entity, T> entity = createEntity(Entity.class);

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.
@@ -38,10 +38,7 @@ public class CamelCaseAbbreviatingFieldNamingStrategyUnitTests {
@Mock PersistentProperty<?> property;
/**
* @see DATACMNS-523
*/
@Test
@Test // DATACMNS-523
public void abbreviatesToCamelCase() {
assertFieldNameForPropertyName("fooBar", "fb");

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,7 +44,6 @@ import org.springframework.test.util.ReflectionTestUtils;
*
* @author Mark Paluch
* @author Oliver Gierke
* @see DATACMNS-809
*/
@RunWith(Parameterized.class)
public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
@@ -124,10 +123,7 @@ public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
return parameters;
}
/**
* @see DATACMNS-809
*/
@Test
@Test // DATACMNS-809
public void shouldSetAndGetProperty() throws Exception {
PersistentProperty<?> property = getProperty(bean, propertyName);
@@ -137,10 +133,7 @@ public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
assertThat(persistentPropertyAccessor.getProperty(property), is(equalTo((Object) value)));
}
/**
* @see DATACMNS-809
*/
@Test
@Test // DATACMNS-809
public void shouldUseClassPropertyAccessorFactory() throws Exception {
BasicPersistentEntity<Object, SamplePersistentProperty> persistentEntity = mappingContext
@@ -161,9 +154,7 @@ public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
return persistentEntity.getPersistentProperty(name);
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@AccessType(Type.FIELD)
public static class FieldAccess {
@@ -211,9 +202,7 @@ public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
String stringArray[];
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@AccessType(Type.PROPERTY)
@Data
public static class PropertyAccess {
@@ -262,9 +251,7 @@ public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
String stringArray[];
}
/**
* @see DATACMNS-916
*/
// DATACMNS-916
@AccessType(Type.FIELD)
private final static class PrivateFinalFieldAccess {
@@ -312,9 +299,7 @@ public class ClassGeneratingPropertyAccessorFactoryDatatypeTests {
String stringArray[];
}
/**
* @see DATACMNS-916
*/
// DATACMNS-916
@AccessType(Type.PROPERTY)
@Data
private final static class PrivateFinalPropertyAccess {

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.
@@ -38,10 +38,7 @@ public class ClassGeneratingPropertyAccessorFactoryEntityTypeTests {
SampleMappingContext mappingContext = new SampleMappingContext();
/**
* @see DATACMNS-853
*/
@Test
@Test // DATACMNS-853
public void getIdentifierOfInterfaceBasedEntity() {
Algorithm quickSort = new QuickSort();
@@ -49,10 +46,7 @@ public class ClassGeneratingPropertyAccessorFactoryEntityTypeTests {
assertThat(getEntityInformation(Algorithm.class).getId(quickSort), is((Object) quickSort.getName()));
}
/**
* @see DATACMNS-853
*/
@Test
@Test // DATACMNS-853
public void getIdentifierOfClassBasedEntity() {
Person jonDoe = new Person("JonDoe");

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.
@@ -43,7 +43,6 @@ import org.springframework.test.util.ReflectionTestUtils;
* Unit tests for {@link ClassGeneratingPropertyAccessorFactory}
*
* @author Mark Paluch
* @see DATACMNS-809
*/
@RunWith(Parameterized.class)
public class ClassGeneratingPropertyAccessorFactoryTests {
@@ -96,11 +95,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
return parameters;
}
/**
* @see DATACMNS-809
* @throws Exception
*/
@Test
@Test // DATACMNS-809
public void shouldSetAndGetProperty() throws Exception {
PersistentProperty<?> property = getProperty(bean, propertyName);
@@ -110,11 +105,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
assertThat(persistentPropertyAccessor.getProperty(property), is(equalTo((Object) "value")));
}
/**
* @see DATACMNS-809
* @throws Exception
*/
@Test
@Test // DATACMNS-809
@SuppressWarnings("rawtypes")
public void accessorShouldDeclareConstructor() throws Exception {
@@ -126,18 +117,12 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
assertThat(declaredConstructors[0].getParameterTypes()[0], is(equalTo((Class) expectedConstructorType)));
}
/**
* @see DATACMNS-809
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-809
public void shouldFailOnNullBean() {
factory.getPropertyAccessor(mappingContext.getPersistentEntity(bean.getClass()), null);
}
/**
* @see DATACMNS-809
*/
@Test(expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class) // DATACMNS-809
public void getPropertyShouldFailOnUnhandledProperty() {
PersistentProperty<?> property = getProperty(new Dummy(), "dummy");
@@ -146,10 +131,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
persistentPropertyAccessor.getProperty(property);
}
/**
* @see DATACMNS-809
*/
@Test(expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class) // DATACMNS-809
public void setPropertyShouldFailOnUnhandledProperty() {
PersistentProperty<?> property = getProperty(new Dummy(), "dummy");
@@ -158,10 +140,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
persistentPropertyAccessor.setProperty(property, null);
}
/**
* @see DATACMNS-809
*/
@Test
@Test // DATACMNS-809
public void shouldUseClassPropertyAccessorFactory() throws Exception {
BasicPersistentEntity<Object, SamplePersistentProperty> persistentEntity = mappingContext
@@ -182,9 +161,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
return persistentEntity.getPersistentProperty(name);
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@SuppressWarnings("unused")
private static class InnerPrivateType {
@@ -244,16 +221,12 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
}
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
public static class InnerTypeWithPrivateAncestor extends InnerPrivateType {
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@SuppressWarnings("unused")
static class InnerPackageDefaultType {
@@ -313,9 +286,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
}
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@SuppressWarnings("unused")
protected static class InnerProtectedType {
@@ -375,9 +346,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
}
}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@SuppressWarnings("unused")
public static class InnerPublicType {
@@ -439,9 +408,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
public static class SubtypeOfTypeInOtherPackage extends TypeInOtherPackage {}
/**
* @see DATACMNS-809
*/
// DATACMNS-809
@SuppressWarnings("unused")
private static class Dummy {

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.
@@ -21,7 +21,6 @@ import org.springframework.data.annotation.AccessType.Type;
/**
* @author Mark Paluch
* @author Oliver Gierke
* @see DATACMNS-809
*/
@SuppressWarnings("unused")
class ClassGeneratingPropertyAccessorPackageDefaultType {

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.
@@ -21,7 +21,6 @@ import org.springframework.data.annotation.AccessType.Type;
/**
* @author Mark Paluch
* @author Oliver Gierke
* @see DATACMNS-809
*/
@SuppressWarnings("unused")
public class ClassGeneratingPropertyAccessorPublicType {

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.
@@ -35,36 +35,24 @@ public class ConvertingPropertyAccessorUnitTests {
static final ConversionService CONVERSION_SERVICE = new DefaultFormattingConversionService();
/**
* @see DATACMNS-596
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-596
public void rejectsNullPropertyAccessorDelegate() {
new ConvertingPropertyAccessor(null, CONVERSION_SERVICE);
}
/**
* @see DATACMNS-596
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-596
public void rejectsNullConversionService() {
new ConvertingPropertyAccessor(new BeanWrapper<Object>(new Object()), null);
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void returnsBeanFromDelegate() {
Object entity = new Entity();
assertThat(getAccessor(entity, CONVERSION_SERVICE).getBean(), is(entity));
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void convertsPropertyValueToExpectedType() {
Entity entity = new Entity();
@@ -75,10 +63,7 @@ public class ConvertingPropertyAccessorUnitTests {
assertThat(accessor.getProperty(getIdProperty(), String.class), is("1"));
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void doesNotInvokeConversionForNullValues() {
ConversionService conversionService = mock(ConversionService.class);
@@ -88,10 +73,7 @@ public class ConvertingPropertyAccessorUnitTests {
verify(conversionService, times(0)).convert(1L, Number.class);
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void doesNotInvokeConversionIfTypeAlreadyMatches() {
Entity entity = new Entity();
@@ -104,10 +86,7 @@ public class ConvertingPropertyAccessorUnitTests {
verify(conversionService, times(0)).convert(1L, Number.class);
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void convertsValueOnSetIfTypesDontMatch() {
Entity entity = new Entity();
@@ -118,10 +97,7 @@ public class ConvertingPropertyAccessorUnitTests {
assertThat(entity.id, is(1L));
}
/**
* @see DATACMNS-596
*/
@Test
@Test // DATACMNS-596
public void doesNotInvokeConversionIfTypeAlreadyMatchesOnSet() {
ConvertingPropertyAccessor accessor = getAccessor(new Entity(), mock(ConversionService.class));

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.
@@ -30,28 +30,19 @@ public class IdPropertyIdentifierAccessorUnitTests {
SampleMappingContext mappingContext = new SampleMappingContext();
/**
* @see DATACMNS-599
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-599
public void rejectsEntityWithoutIdentifierProperty() {
new IdPropertyIdentifierAccessor(mappingContext.getPersistentEntity(Sample.class), new Sample());
}
/**
* @see DATACMNS-599
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATACMNS-599
public void rejectsNullBean() {
new IdPropertyIdentifierAccessor(mappingContext.getPersistentEntity(SampleWithId.class), null);
}
/**
* @see DATACMNS-599
*/
@Test
@Test // DATACMNS-599
public void returnsIdentifierValue() {
SampleWithId sample = new SampleWithId();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 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.
@@ -49,10 +49,7 @@ public class PersistentEntityParameterValueProviderUnitTests<P extends Persisten
@Mock
P property;
/**
* @see DATACMNS-134
*/
@Test
@Test // DATACMNS-134
public void usesParentObjectAsImplicitFirstConstructorArgument() {
Object outer = new Outer();

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.
@@ -39,10 +39,7 @@ public class SnakeCaseFieldNamingStrategyUnitTests {
@Mock PersistentProperty<?> property;
/**
* @see DATACMNS-523
*/
@Test
@Test // DATACMNS-523
public void rendersSnakeCaseFieldNames() {
assertFieldNameForPropertyName("fooBar", "foo_bar");

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.
@@ -21,7 +21,6 @@ import org.springframework.data.annotation.AccessType.Type;
/**
* @author Mark Paluch
* @see DATACMNS-809
*/
public class TypeInOtherPackage {