DATACMNS-973 - Migrate ticket references in test code to Spring Framework style.
This commit is contained in:
@@ -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,10 +30,7 @@ import org.springframework.data.util.AnnotatedTypeScanner;
|
||||
*/
|
||||
public class TypeAliasUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-547
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-547
|
||||
@SuppressWarnings("unchecked")
|
||||
public void scanningforAtPersistentFindsTypeAliasAnnotatedTypes() {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2015 the original author or authors.
|
||||
* Copyright 2008-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.
|
||||
@@ -142,10 +142,7 @@ public class AuditingHandlerUnitTests {
|
||||
assertNull(user.getLastModifiedDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-9
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAJPA-9
|
||||
public void usesDateTimeProviderIfConfigured() {
|
||||
|
||||
DateTimeProvider provider = mock(DateTimeProvider.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 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.
|
||||
@@ -60,10 +60,7 @@ public class DefaultAuditableBeanWrapperFactoryUnitTests {
|
||||
assertThat(wrapper, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-643
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-643
|
||||
public void setsJsr310AndThreeTenBpTypes() {
|
||||
|
||||
Jsr310ThreeTenBpAuditedUser user = new Jsr310ThreeTenBpAuditedUser();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2015 the original author or authors.
|
||||
* Copyright 2008-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.
|
||||
@@ -72,26 +72,17 @@ public class IsNewAwareAuditingHandlerUnitTests extends AuditingHandlerUnitTests
|
||||
assertThat(user.modifiedDate, is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-365
|
||||
public void rejectsNullMappingContext() {
|
||||
new IsNewAwareAuditingHandler((PersistentEntities) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-365
|
||||
public void setsUpHandlerWithMappingContext() {
|
||||
new IsNewAwareAuditingHandler(new PersistentEntities(Collections.<MappingContext<?, ?>> emptySet()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-638
|
||||
public void handlingNullIsANoOp() {
|
||||
|
||||
IsNewAwareAuditingHandler handler = getHandler();
|
||||
|
||||
@@ -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.
|
||||
@@ -58,10 +58,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
factory = new MappingAuditableBeanWrapperFactory(entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-365
|
||||
public void discoversAuditingPropertyOnField() {
|
||||
|
||||
Sample sample = new Sample();
|
||||
@@ -73,10 +70,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
assertThat(sample.createdBy, is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-365
|
||||
public void discoversAuditingPropertyOnAccessor() {
|
||||
|
||||
Sample sample = new Sample();
|
||||
@@ -88,10 +82,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
assertThat(sample.lastModifiedBy, is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-365
|
||||
public void settingInavailablePropertyIsNoop() {
|
||||
|
||||
Sample sample = new Sample();
|
||||
@@ -100,28 +91,19 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
wrapper.setLastModifiedDate(new GregorianCalendar());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-365
|
||||
public void doesNotReturnWrapperForEntityNotUsingAuditing() {
|
||||
assertThat(factory.getBeanWrapperFor(new NoAuditing()), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-365
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-365
|
||||
public void returnsAuditableWrapperForAuditable() {
|
||||
|
||||
assertThat(factory.getBeanWrapperFor(mock(ExtendingAuditable.class)),
|
||||
is(instanceOf(AuditableInterfaceBeanWrapper.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-638
|
||||
public void returnsLastModificationCalendarAsCalendar() {
|
||||
|
||||
Date reference = new Date();
|
||||
@@ -132,10 +114,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
assertLastModificationDate(calendar, reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-638
|
||||
public void returnsLastModificationDateTimeAsCalendar() {
|
||||
|
||||
DateTime reference = new DateTime();
|
||||
@@ -143,10 +122,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
assertLastModificationDate(reference, reference.toDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-638
|
||||
public void returnsLastModificationDateAsCalendar() {
|
||||
|
||||
Date reference = new Date();
|
||||
@@ -154,10 +130,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
assertLastModificationDate(reference, reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-638, DATACMNS-43
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-638, DATACMNS-43
|
||||
public void returnsLastModificationJsr310DateTimeAsCalendar() {
|
||||
|
||||
LocalDateTime reference = LocalDateTime.now();
|
||||
@@ -165,10 +138,7 @@ public class MappingAuditableBeanWrapperFactoryUnitTests {
|
||||
assertLastModificationDate(reference, LocalDateTimeToDateConverter.INSTANCE.convert(reference));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-638, DATACMNS-43
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-638, DATACMNS-43
|
||||
public void returnsLastModificationThreeTenBpDateTimeAsCalendar() {
|
||||
|
||||
org.threeten.bp.LocalDateTime reference = org.threeten.bp.LocalDateTime.now();
|
||||
|
||||
@@ -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.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -41,10 +41,7 @@ public class AuditingBeanDefinitionRegistrarSupportUnitTests {
|
||||
|
||||
@Mock BeanDefinitionRegistry registry;
|
||||
|
||||
/**
|
||||
* @see DATCMNS-389
|
||||
*/
|
||||
@Test
|
||||
@Test // DATCMNS-389
|
||||
public void testRegisterBeanDefinitions() {
|
||||
|
||||
AuditingBeanDefinitionRegistrarSupport registrar = new DummyAuditingBeanDefinitionRegistrarSupport();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011 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.
|
||||
@@ -37,20 +37,14 @@ public class UserCredentialsUnitTests {
|
||||
assertThat(credentials.hasPassword(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-142
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-142
|
||||
public void noCredentialsNullsUsernameAndPassword() {
|
||||
|
||||
assertThat(UserCredentials.NO_CREDENTIALS.getUsername(), is(nullValue()));
|
||||
assertThat(UserCredentials.NO_CREDENTIALS.getPassword(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-142
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-142
|
||||
public void configuresUsernameCorrectly() {
|
||||
|
||||
UserCredentials credentials = new UserCredentials("username", null);
|
||||
@@ -61,10 +55,7 @@ public class UserCredentialsUnitTests {
|
||||
assertThat(credentials.getPassword(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-142
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-142
|
||||
public void configuresPasswordCorrectly() {
|
||||
|
||||
UserCredentials credentials = new UserCredentials(null, "password");
|
||||
@@ -75,37 +66,24 @@ public class UserCredentialsUnitTests {
|
||||
assertThat(credentials.getPassword(), is("password"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-275
|
||||
*/
|
||||
|
||||
@Test
|
||||
@Test // DATACMNS-275
|
||||
public void returnsNullForNotSetObfuscatedPassword() {
|
||||
assertThat(new UserCredentials(null, null).getObfuscatedPassword(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-275
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-275
|
||||
public void obfuscatesShortPasswordsEntirely() {
|
||||
|
||||
assertThat(new UserCredentials(null, "sa").getObfuscatedPassword(), is("**"));
|
||||
assertThat(new UserCredentials(null, "s").getObfuscatedPassword(), is("*"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-275
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-275
|
||||
public void returnsObfuscatedPasswordCorrectly() {
|
||||
assertThat(new UserCredentials(null, "password").getObfuscatedPassword(), is("p******d"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-275
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-275
|
||||
public void toStringDoesNotExposePlainPassword() {
|
||||
|
||||
UserCredentials credentials = new UserCredentials(null, "mypassword");
|
||||
|
||||
@@ -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.
|
||||
@@ -89,10 +89,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
verify(provider, times(1)).getParameterValue((Parameter) constructor.getParameters().iterator().next());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-300, DATACMNS-578
|
||||
*/
|
||||
@Test(expected = MappingInstantiationException.class)
|
||||
@Test(expected = MappingInstantiationException.class) // DATACMNS-300, DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void throwsExceptionOnBeanInstantiationException() {
|
||||
|
||||
@@ -102,10 +99,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
INSTANCE.createInstance(entity, provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-134, DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-134, DATACMNS-578
|
||||
public void createsInnerClassInstanceCorrectly() {
|
||||
|
||||
BasicPersistentEntity<Inner, P> entity = new BasicPersistentEntity<Inner, P>(from(Inner.class));
|
||||
@@ -130,10 +124,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-283, DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-283, DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void capturesContextOnInstantiationException() throws Exception {
|
||||
|
||||
@@ -162,10 +153,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtorDefault() {
|
||||
|
||||
@@ -181,10 +169,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtorNoArgs() {
|
||||
|
||||
@@ -201,10 +186,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtor1ParamString() {
|
||||
|
||||
@@ -224,10 +206,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtor2ParamStringString() {
|
||||
|
||||
@@ -248,10 +227,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjectCtor1ParamInt() {
|
||||
|
||||
@@ -271,10 +247,7 @@ public class BytecodeGeneratingEntityInstantiatorUnitTests<P extends PersistentP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjectCtor7ParamsString5IntsString() {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -89,10 +89,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
verify(provider, times(1)).getParameterValue((Parameter) constructor.getParameters().iterator().next());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-300, DATACMNS-578
|
||||
*/
|
||||
@Test(expected = MappingInstantiationException.class)
|
||||
@Test(expected = MappingInstantiationException.class) // DATACMNS-300, DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void throwsExceptionOnBeanInstantiationException() {
|
||||
|
||||
@@ -102,10 +99,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
this.instance.createInstance(entity, provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-134, DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-134, DATACMNS-578
|
||||
public void createsInnerClassInstanceCorrectly() {
|
||||
|
||||
BasicPersistentEntity<Inner, P> entity = new BasicPersistentEntity<Inner, P>(from(Inner.class));
|
||||
@@ -130,10 +124,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-283, DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-283, DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void capturesContextOnInstantiationException() throws Exception {
|
||||
|
||||
@@ -162,10 +153,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtorDefault() {
|
||||
|
||||
@@ -181,10 +169,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtorNoArgs() {
|
||||
|
||||
@@ -201,10 +186,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtor1ParamString() {
|
||||
|
||||
@@ -224,10 +206,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjCtor2ParamStringString() {
|
||||
|
||||
@@ -248,10 +227,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjectCtor1ParamInt() {
|
||||
|
||||
@@ -271,10 +247,7 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-578
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-578
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void instantiateObjectCtor7ParamsString5IntsString() {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -71,10 +71,7 @@ public class DefaultTypeMapperUnitTests {
|
||||
verify(mapper, times(1)).resolveTypeFrom(STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-349
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-349
|
||||
public void returnsTypeAliasForInformation() {
|
||||
|
||||
Object alias = "alias";
|
||||
@@ -83,10 +80,7 @@ public class DefaultTypeMapperUnitTests {
|
||||
assertThat(this.typeMapper.getAliasFor(STRING_TYPE_INFO), is(alias));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-783
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-783
|
||||
public void specializesRawSourceTypeUsingGenericContext() {
|
||||
|
||||
ClassTypeInformation<Foo> root = ClassTypeInformation.from(Foo.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -74,75 +74,51 @@ public class Jsr310ConvertersUnitTests {
|
||||
|
||||
public static class CommonTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsDateToLocalDateTime() {
|
||||
assertThat(CONVERSION_SERVICE.convert(NOW, LocalDateTime.class).toString(),
|
||||
is(format(NOW, "yyyy-MM-dd'T'HH:mm:ss.SSS")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsLocalDateTimeToDate() {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
assertThat(format(CONVERSION_SERVICE.convert(now, Date.class), "yyyy-MM-dd'T'HH:mm:ss.SSS"), is(now.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsDateToLocalDate() {
|
||||
assertThat(CONVERSION_SERVICE.convert(NOW, LocalDate.class).toString(), is(format(NOW, "yyyy-MM-dd")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsLocalDateToDate() {
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
assertThat(format(CONVERSION_SERVICE.convert(now, Date.class), "yyyy-MM-dd"), is(now.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsDateToLocalTime() {
|
||||
assertThat(CONVERSION_SERVICE.convert(NOW, LocalTime.class).toString(), is(format(NOW, "HH:mm:ss.SSS")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsLocalTimeToDate() {
|
||||
|
||||
LocalTime now = LocalTime.now();
|
||||
assertThat(format(CONVERSION_SERVICE.convert(now, Date.class), "HH:mm:ss.SSS"), is(now.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-623
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-623
|
||||
public void convertsDateToInstant() {
|
||||
|
||||
Date now = new Date();
|
||||
assertThat(CONVERSION_SERVICE.convert(now, Instant.class), is(now.toInstant()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-623
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-623
|
||||
public void convertsInstantToDate() {
|
||||
|
||||
Date now = new Date();
|
||||
@@ -170,9 +146,7 @@ public class Jsr310ConvertersUnitTests {
|
||||
@RunWith(Parameterized.class)
|
||||
public static class DurationConversionTests extends ConversionTest<Duration> {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-951
|
||||
*/
|
||||
// DATACMNS-951
|
||||
@Parameters
|
||||
public static Collection<Object[]> data() {
|
||||
|
||||
@@ -189,9 +163,7 @@ public class Jsr310ConvertersUnitTests {
|
||||
|
||||
public static class PeriodConversionTests extends ConversionTest<Period> {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-951
|
||||
*/
|
||||
// DATACMNS-951
|
||||
@Parameters
|
||||
public static Collection<Object[]> data() {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -99,10 +99,7 @@ public class MappingContextTypeInformationMapperUnitTests {
|
||||
assertThat(mapper.resolveTypeFrom("foo"), is((TypeInformation) from(Entity.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-485
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-485
|
||||
@SuppressWarnings("unchecked")
|
||||
public void createsTypeMapperForGenericTypesWithDifferentBindings() {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 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.
|
||||
@@ -92,10 +92,7 @@ public class ReflectionEntityInstantiatorUnitTests<P extends PersistentProperty<
|
||||
verify(provider, times(1)).getParameterValue((Parameter) constructor.getParameters().iterator().next());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-300
|
||||
*/
|
||||
@Test(expected = MappingInstantiationException.class)
|
||||
@Test(expected = MappingInstantiationException.class) // DATACMNS-300
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void throwsExceptionOnBeanInstantiationException() {
|
||||
|
||||
@@ -105,10 +102,7 @@ public class ReflectionEntityInstantiatorUnitTests<P extends PersistentProperty<
|
||||
INSTANCE.createInstance(entity, provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-134
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-134
|
||||
public void createsInnerClassInstanceCorrectly() {
|
||||
|
||||
BasicPersistentEntity<Inner, P> entity = new BasicPersistentEntity<Inner, P>(from(Inner.class));
|
||||
@@ -133,10 +127,7 @@ public class ReflectionEntityInstantiatorUnitTests<P extends PersistentProperty<
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-283
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-283
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void capturesContextOnInstantiationException() throws Exception {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -57,75 +57,51 @@ public class ThreeTenBackPortConvertersUnitTests {
|
||||
CONVERSION_SERVICE = conversionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsDateToLocalDateTime() {
|
||||
assertThat(CONVERSION_SERVICE.convert(NOW, LocalDateTime.class).toString(),
|
||||
is(format(NOW, "yyyy-MM-dd'T'HH:mm:ss.SSS")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsLocalDateTimeToDate() {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
assertThat(format(CONVERSION_SERVICE.convert(now, Date.class), "yyyy-MM-dd'T'HH:mm:ss.SSS"), is(now.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsDateToLocalDate() {
|
||||
assertThat(CONVERSION_SERVICE.convert(NOW, LocalDate.class).toString(), is(format(NOW, "yyyy-MM-dd")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsLocalDateToDate() {
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
assertThat(format(CONVERSION_SERVICE.convert(now, Date.class), "yyyy-MM-dd"), is(now.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsDateToLocalTime() {
|
||||
assertThat(CONVERSION_SERVICE.convert(NOW, LocalTime.class).toString(), is(format(NOW, "HH:mm:ss.SSS")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-606
|
||||
public void convertsLocalTimeToDate() {
|
||||
|
||||
LocalTime now = LocalTime.now();
|
||||
assertThat(format(CONVERSION_SERVICE.convert(now, Date.class), "HH:mm:ss.SSS"), is(now.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-623
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-623
|
||||
public void convertsDateToInstant() {
|
||||
|
||||
Date now = new Date();
|
||||
assertThat(CONVERSION_SERVICE.convert(now, Instant.class), is(toInstant(now)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-623
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-623
|
||||
public void convertsInstantToDate() {
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
@@ -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.
|
||||
@@ -72,10 +72,7 @@ public abstract class AbstractPageRequestUnitTests {
|
||||
assertNotEqualsAndHashcode(request, newPageRequest(0, 11));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-377
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-377
|
||||
public void preventsPageSizeLessThanOne() {
|
||||
newPageRequest(0, 0);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -40,50 +40,32 @@ public class ExampleMatcherUnitTests {
|
||||
matcher = matching();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void defaultStringMatcherShouldReturnDefault() throws Exception {
|
||||
assertThat(matcher.getDefaultStringMatcher(), is(StringMatcher.DEFAULT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoreCaseShouldReturnFalseByDefault() throws Exception {
|
||||
assertThat(matcher.isIgnoreCaseEnabled(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoredPathsIsEmptyByDefault() throws Exception {
|
||||
assertThat(matcher.getIgnoredPaths(), is(empty()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void nullHandlerShouldReturnIgnoreByDefault() throws Exception {
|
||||
assertThat(matcher.getNullHandler(), is(NullHandler.IGNORE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test(expected = UnsupportedOperationException.class) // DATACMNS-810
|
||||
public void ignoredPathsIsNotModifiable() throws Exception {
|
||||
matcher.getIgnoredPaths().add("¯\\_(ツ)_/¯");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoreCaseShouldReturnTrueWhenIgnoreCaseEnabled() throws Exception {
|
||||
|
||||
matcher = matching().withIgnoreCase();
|
||||
@@ -91,10 +73,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.isIgnoreCaseEnabled(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoreCaseShouldReturnTrueWhenIgnoreCaseSet() throws Exception {
|
||||
|
||||
matcher = matching().withIgnoreCase(true);
|
||||
@@ -102,10 +81,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.isIgnoreCaseEnabled(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void nullHandlerShouldReturnInclude() throws Exception {
|
||||
|
||||
matcher = matching().withIncludeNullValues();
|
||||
@@ -113,10 +89,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.getNullHandler(), is(NullHandler.INCLUDE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void nullHandlerShouldReturnIgnore() throws Exception {
|
||||
|
||||
matcher = matching().withIgnoreNullValues();
|
||||
@@ -124,10 +97,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.getNullHandler(), is(NullHandler.IGNORE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void nullHandlerShouldReturnConfiguredValue() throws Exception {
|
||||
|
||||
matcher = matching().withNullHandler(NullHandler.INCLUDE);
|
||||
@@ -135,10 +105,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.getNullHandler(), is(NullHandler.INCLUDE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoredPathsShouldReturnCorrectProperties() throws Exception {
|
||||
|
||||
matcher = matching().withIgnorePaths("foo", "bar", "baz");
|
||||
@@ -147,10 +114,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.getIgnoredPaths(), hasSize(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoredPathsShouldReturnUniqueProperties() throws Exception {
|
||||
|
||||
matcher = matching().withIgnorePaths("foo", "bar", "foo");
|
||||
@@ -159,10 +123,7 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(matcher.getIgnoredPaths(), hasSize(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void withCreatesNewInstance() throws Exception {
|
||||
|
||||
matcher = matching().withIgnorePaths("foo", "bar", "foo");
|
||||
@@ -176,40 +137,28 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(configuredExampleSpec.isIgnoreCaseEnabled(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-879
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-879
|
||||
public void defaultMatcherRequiresAllMatching() {
|
||||
|
||||
assertThat(matching().isAllMatching(), is(true));
|
||||
assertThat(matching().isAnyMatching(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-879
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-879
|
||||
public void allMatcherRequiresAllMatching() {
|
||||
|
||||
assertThat(matchingAll().isAllMatching(), is(true));
|
||||
assertThat(matchingAll().isAnyMatching(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-879
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-879
|
||||
public void anyMatcherYieldsAnyMatching() {
|
||||
|
||||
assertThat(matchingAny().isAnyMatching(), is(true));
|
||||
assertThat(matchingAny().isAllMatching(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-900
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-900
|
||||
public void shouldCompareUsingHashCodeAndEquals() throws Exception {
|
||||
|
||||
matcher = matching() //
|
||||
|
||||
@@ -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,26 +44,17 @@ public class ExampleUnitTests {
|
||||
example = Example.of(person);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-810
|
||||
public void rejectsNullProbe() {
|
||||
Example.of(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void returnsSampleObjectsClassAsProbeType() {
|
||||
assertThat(example.getProbeType(), is(equalTo(Person.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-900
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-900
|
||||
public void shouldCompareUsingHashCodeAndEquals() throws Exception {
|
||||
|
||||
Example<Person> example = Example.of(person, matching().withIgnoreCase("firstname"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2015 the original author or authors.
|
||||
* Copyright 2008-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.
|
||||
@@ -115,10 +115,7 @@ public class PageImplUnitTests {
|
||||
assertThat(page.hasContent(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-323
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-323
|
||||
public void returnsCorrectTotalPages() {
|
||||
|
||||
Page<String> page = new PageImpl<String>(Arrays.asList("a"));
|
||||
@@ -128,10 +125,7 @@ public class PageImplUnitTests {
|
||||
assertThat(page.hasPrevious(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-635
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-635
|
||||
public void transformsPageCorrectly() {
|
||||
|
||||
Page<Integer> transformed = new PageImpl<String>(Arrays.asList("foo", "bar"), new PageRequest(0, 2), 10)
|
||||
@@ -146,44 +140,29 @@ public class PageImplUnitTests {
|
||||
assertThat(transformed.getContent(), contains(3, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-713
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-713
|
||||
public void adaptsTotalForLastPageOnIntermediateDeletion() {
|
||||
assertThat(new PageImpl<String>(Arrays.asList("foo", "bar"), new PageRequest(0, 5), 3).getTotalElements(), is(2L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-713
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-713
|
||||
public void adaptsTotalForLastPageOnIntermediateInsertion() {
|
||||
assertThat(new PageImpl<String>(Arrays.asList("foo", "bar"), new PageRequest(0, 5), 1).getTotalElements(), is(2L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-713
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-713
|
||||
public void adaptsTotalForLastPageOnIntermediateDeletionOnLastPate() {
|
||||
assertThat(new PageImpl<String>(Arrays.asList("foo", "bar"), new PageRequest(1, 10), 13).getTotalElements(),
|
||||
is(12L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-713
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-713
|
||||
public void adaptsTotalForLastPageOnIntermediateInsertionOnLastPate() {
|
||||
assertThat(new PageImpl<String>(Arrays.asList("foo", "bar"), new PageRequest(1, 10), 11).getTotalElements(),
|
||||
is(12L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-713
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-713
|
||||
public void doesNotAdapttotalIfPageIsEmpty() {
|
||||
|
||||
assertThat(new PageImpl<String>(Collections.<String> emptyList(), new PageRequest(1, 10), 0).getTotalElements(),
|
||||
|
||||
@@ -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.
|
||||
@@ -28,18 +28,12 @@ import org.junit.Test;
|
||||
*/
|
||||
public class RangeUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-651
|
||||
public void rejectsNullReferenceValuesForContains() {
|
||||
new Range<Long>(10L, 20L).contains(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void usesBoundsInclusivelyByDefault() {
|
||||
|
||||
Range<Long> range = new Range<Long>(10L, 20L);
|
||||
@@ -51,10 +45,7 @@ public class RangeUnitTests {
|
||||
assertThat(range.contains(25L), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void excludesLowerBoundIfConfigured() {
|
||||
|
||||
Range<Long> range = new Range<Long>(10L, 20L, false, true);
|
||||
@@ -66,10 +57,7 @@ public class RangeUnitTests {
|
||||
assertThat(range.contains(25L), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void excludesUpperBoundIfConfigured() {
|
||||
|
||||
Range<Long> range = new Range<Long>(10L, 20L, true, false);
|
||||
@@ -81,10 +69,7 @@ public class RangeUnitTests {
|
||||
assertThat(range.contains(25L), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void handlesOpenUpperBoundCorrectly() {
|
||||
|
||||
Range<Long> range = new Range<Long>(10L, null);
|
||||
@@ -96,10 +81,7 @@ public class RangeUnitTests {
|
||||
assertThat(range.contains(25L), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void handlesOpenLowerBoundCorrectly() {
|
||||
|
||||
Range<Long> range = new Range<Long>(null, 20L);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2014 the original author or authors.
|
||||
* Copyright 2008-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.
|
||||
@@ -102,28 +102,17 @@ public class SortUnitTests {
|
||||
assertThat(sort, hasItem(new Sort.Order("foo")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-281
|
||||
* @author Kevin Raymond
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-281
|
||||
public void configuresIgnoreCaseForOrder() {
|
||||
assertThat(new Order(Direction.ASC, "foo").ignoreCase().isIgnoreCase(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-281
|
||||
* @author Kevin Raymond
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-281
|
||||
public void orderDoesNotIgnoreCaseByDefault() {
|
||||
assertThat(new Order(Direction.ASC, "foo").isIgnoreCase(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-436
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-436
|
||||
public void ordersWithDifferentIgnoreCaseDoNotEqual() {
|
||||
|
||||
Order foo = new Order("foo");
|
||||
@@ -133,42 +122,27 @@ public class SortUnitTests {
|
||||
assertThat(foo.hashCode(), is(not(fooIgnoreCase.hashCode())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-491
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-491
|
||||
public void orderWithNullHandlingHintNullsFirst() {
|
||||
assertThat(new Order("foo").nullsFirst().getNullHandling(), is(NULLS_FIRST));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-491
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-491
|
||||
public void orderWithNullHandlingHintNullsLast() {
|
||||
assertThat(new Order("foo").nullsLast().getNullHandling(), is(NULLS_LAST));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-491
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-491
|
||||
public void orderWithNullHandlingHintNullsNative() {
|
||||
assertThat(new Order("foo").nullsNative().getNullHandling(), is(NATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-491
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-491
|
||||
public void orderWithDefaultNullHandlingHint() {
|
||||
assertThat(new Order("foo").getNullHandling(), is(NATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-908
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-908
|
||||
public void createsNewOrderForDifferentProperty() {
|
||||
|
||||
Order source = new Order(Direction.DESC, "foo").nullsFirst().ignoreCase();
|
||||
|
||||
@@ -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.
|
||||
@@ -33,10 +33,7 @@ public class BoxUnitTests {
|
||||
Box second = new Box(new Point(1d, 1d), new Point(2d, 2d));
|
||||
Box third = new Box(new Point(3d, 3d), new Point(1d, 1d));
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void equalsWorksCorrectly() {
|
||||
|
||||
assertThat(first.equals(second), is(true));
|
||||
@@ -44,29 +41,20 @@ public class BoxUnitTests {
|
||||
assertThat(first.equals(third), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void hashCodeWorksCorrectly() {
|
||||
|
||||
assertThat(first.hashCode(), is(second.hashCode()));
|
||||
assertThat(first.hashCode(), is(not(third.hashCode())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void testToString() {
|
||||
|
||||
assertThat(first.toString(), is("Box [Point [x=1.000000, y=1.000000], Point [x=2.000000, y=2.000000]]"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
Box serialized = (Box) SerializationUtils.deserialize(SerializationUtils.serialize(first));
|
||||
|
||||
@@ -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.
|
||||
@@ -29,26 +29,17 @@ import org.springframework.util.SerializationUtils;
|
||||
*/
|
||||
public class CircleUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-437
|
||||
public void rejectsNullOrigin() {
|
||||
new Circle(null, new Distance(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-437
|
||||
public void rejectsNegativeRadius() {
|
||||
new Circle(1, 1, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void considersTwoCirclesEqualCorrectly() {
|
||||
|
||||
Circle left = new Circle(1, 1, 1);
|
||||
@@ -63,19 +54,13 @@ public class CircleUnitTests {
|
||||
assertThat(right, is(left));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void testToString() {
|
||||
|
||||
assertThat(new Circle(1, 1, 1).toString(), is("Circle: [center=Point [x=1.000000, y=1.000000], radius=1.0]"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
Circle circle = new Circle(1, 1, 1);
|
||||
|
||||
@@ -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.
|
||||
@@ -35,20 +35,14 @@ public class DistanceUnitTests {
|
||||
private static final double TEN_MILES_NORMALIZED = 0.002523219294755161;
|
||||
private static final double TEN_KM_NORMALIZED = 0.001567855942887398;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void defaultsMetricToNeutralOne() {
|
||||
|
||||
assertThat(new Distance(2.5).getMetric(), is((Metric) Metrics.NEUTRAL));
|
||||
assertThat(new Distance(2.5, null).getMetric(), is((Metric) Metrics.NEUTRAL));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void addsDistancesWithoutExplicitMetric() {
|
||||
|
||||
Distance left = new Distance(2.5, KILOMETERS);
|
||||
@@ -57,10 +51,7 @@ public class DistanceUnitTests {
|
||||
assertThat(left.add(right), is(new Distance(5.0, KILOMETERS)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void addsDistancesWithExplicitMetric() {
|
||||
|
||||
Distance left = new Distance(2.5, KILOMETERS);
|
||||
@@ -69,10 +60,7 @@ public class DistanceUnitTests {
|
||||
assertThat(left.add(right, MILES), is(new Distance(3.106856281073925, MILES)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-474
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-474
|
||||
public void distanceWithSameMetricShoudEqualAfterConversion() {
|
||||
|
||||
assertThat(new Distance(1).in(NEUTRAL), is(new Distance(1)));
|
||||
@@ -80,20 +68,14 @@ public class DistanceUnitTests {
|
||||
assertThat(new Distance(TEN_MILES_NORMALIZED).in(MILES), is(new Distance(10, MILES)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-474
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-474
|
||||
public void distanceWithDifferentMetricShoudEqualAfterConversion() {
|
||||
|
||||
assertThat(new Distance(10, MILES), is(new Distance(TEN_MILES_NORMALIZED).in(MILES)));
|
||||
assertThat(new Distance(10, KILOMETERS), is(new Distance(TEN_KM_NORMALIZED).in(KILOMETERS)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-474
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-474
|
||||
public void conversionShouldProduceCorrectNormalizedValue() {
|
||||
|
||||
assertThat(new Distance(TEN_KM_NORMALIZED, NEUTRAL).in(KILOMETERS).getNormalizedValue(),
|
||||
@@ -115,10 +97,7 @@ public class DistanceUnitTests {
|
||||
closeTo(new Distance(6.21371192, MILES).getNormalizedValue(), EPS));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-474
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-474
|
||||
public void toStringAfterConversion() {
|
||||
|
||||
assertThat(new Distance(10, KILOMETERS).in(MILES).toString(), is(new Distance(6.21371256214785, MILES).toString()));
|
||||
@@ -126,10 +105,7 @@ public class DistanceUnitTests {
|
||||
is(new Distance(10, KILOMETERS).toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
Distance dist = new Distance(10, KILOMETERS);
|
||||
@@ -138,18 +114,12 @@ public class DistanceUnitTests {
|
||||
assertThat(serialized, is(dist));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-626
|
||||
public void returnsMetricsAbbreviationAsUnit() {
|
||||
assertThat(new Distance(10, KILOMETERS).getUnit(), is("km"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void createsARangeCorrectly() {
|
||||
|
||||
Distance twoKilometers = new Distance(2, KILOMETERS);
|
||||
@@ -162,10 +132,7 @@ public class DistanceUnitTests {
|
||||
assertThat(range.getUpperBound(), is(tenKilometers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void createsARangeFromPiecesCorrectly() {
|
||||
|
||||
Distance twoKilometers = new Distance(2, KILOMETERS);
|
||||
@@ -178,10 +145,7 @@ public class DistanceUnitTests {
|
||||
assertThat(range.getUpperBound(), is(tenKilometers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-651
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-651
|
||||
public void implementsComparableCorrectly() {
|
||||
|
||||
Distance twoKilometers = new Distance(2, KILOMETERS);
|
||||
|
||||
@@ -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,10 +39,7 @@ public class GeoModuleIntegrationTests {
|
||||
this.mapper.registerModule(new GeoModule());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-475
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-475
|
||||
public void deserializesDistance() throws Exception {
|
||||
|
||||
String json = "{\"value\":10.0,\"metric\":\"KILOMETERS\"}";
|
||||
@@ -52,10 +49,7 @@ public class GeoModuleIntegrationTests {
|
||||
assertThat(mapper.writeValueAsString(reference), is(json));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-475
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-475
|
||||
public void deserializesPoint() throws Exception {
|
||||
|
||||
String json = "{\"x\":10.0,\"y\":20.0}";
|
||||
@@ -65,10 +59,7 @@ public class GeoModuleIntegrationTests {
|
||||
assertThat(mapper.writeValueAsString(reference), is(json));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-475
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-475
|
||||
public void deserializesCircle() throws Exception {
|
||||
|
||||
String json = "{\"center\":{\"x\":10.0,\"y\":20.0},\"radius\":{\"value\":10.0,\"metric\":\"KILOMETERS\"}}";
|
||||
@@ -78,10 +69,7 @@ public class GeoModuleIntegrationTests {
|
||||
assertThat(mapper.writeValueAsString(reference), is(json));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-475
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-475
|
||||
public void deserializesBox() throws Exception {
|
||||
|
||||
String json = "{\"first\":{\"x\":1.0,\"y\":2.0},\"second\":{\"x\":2.0,\"y\":3.0}}";
|
||||
@@ -91,10 +79,7 @@ public class GeoModuleIntegrationTests {
|
||||
assertThat(mapper.writeValueAsString(reference), is(json));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-475
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-475
|
||||
public void deserializesPolygon() throws Exception {
|
||||
|
||||
String json = "{\"points\":[{\"x\":1.0,\"y\":2.0},{\"x\":2.0,\"y\":3.0},{\"x\":3.0,\"y\":4.0}]}";
|
||||
|
||||
@@ -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.
|
||||
@@ -34,19 +34,13 @@ public class GeoResultUnitTests {
|
||||
GeoResult<String> third = new GeoResult<String>("Bar", new Distance(2.5));
|
||||
GeoResult<String> fourth = new GeoResult<String>("Foo", new Distance(5.2));
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void considersSameInstanceEqual() {
|
||||
|
||||
assertThat(first.equals(first), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void considersSameValuesAsEqual() {
|
||||
|
||||
assertThat(first.equals(second), is(true));
|
||||
@@ -57,19 +51,13 @@ public class GeoResultUnitTests {
|
||||
assertThat(fourth.equals(first), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-437
|
||||
public void rejectsNullContent() {
|
||||
new GeoResult(null, new Distance(2.5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
GeoResult<String> result = new GeoResult<String>("test", new Distance(2));
|
||||
|
||||
@@ -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.
|
||||
@@ -31,10 +31,7 @@ import org.springframework.util.SerializationUtils;
|
||||
*/
|
||||
public class GeoResultsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
@SuppressWarnings("unchecked")
|
||||
public void calculatesAverageForGivenGeoResults() {
|
||||
|
||||
@@ -45,10 +42,7 @@ public class GeoResultsUnitTests {
|
||||
assertThat(geoResults.getAverageDistance(), is(new Distance(3.5)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
GeoResult<String> result = new GeoResult<String>("test", new Distance(2));
|
||||
|
||||
@@ -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.
|
||||
@@ -29,18 +29,12 @@ import org.springframework.util.SerializationUtils;
|
||||
*/
|
||||
public class PointUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-437
|
||||
public void rejectsNullforCopyConstructor() {
|
||||
new Point(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void equalsIsImplementedCorrectly() {
|
||||
|
||||
assertThat(new Point(1.5, 1.5), is(equalTo(new Point(1.5, 1.5))));
|
||||
@@ -48,18 +42,12 @@ public class PointUnitTests {
|
||||
assertThat(new Point(2.0, 2.0), is(not(equalTo(new Point(1.5, 1.5)))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void invokingToStringWorksCorrectly() {
|
||||
assertThat(new Point(1.5, 1.5).toString(), is("Point [x=1.500000, y=1.500000]"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
Point point = new Point(1.5, 1.5);
|
||||
|
||||
@@ -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.
|
||||
@@ -33,18 +33,12 @@ public class PolygonUnitTests {
|
||||
Point second = new Point(2, 2);
|
||||
Point third = new Point(3, 3);
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-437
|
||||
public void rejectsNullPoints() {
|
||||
new Polygon(null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void createsSimplePolygon() {
|
||||
|
||||
Polygon polygon = new Polygon(third, second, first);
|
||||
@@ -52,10 +46,7 @@ public class PolygonUnitTests {
|
||||
assertThat(polygon, is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void isEqualForSamePoints() {
|
||||
|
||||
Polygon left = new Polygon(third, second, first);
|
||||
@@ -65,20 +56,14 @@ public class PolygonUnitTests {
|
||||
assertThat(right, is(left));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-437
|
||||
public void testToString() {
|
||||
|
||||
assertThat(new Polygon(third, second, first).toString(),
|
||||
is("Polygon: [Point [x=3.000000, y=3.000000],Point [x=2.000000, y=2.000000],Point [x=1.000000, y=1.000000]]"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-482
|
||||
public void testSerialization() {
|
||||
|
||||
Polygon polygon = new Polygon(third, second, first);
|
||||
|
||||
@@ -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.
|
||||
@@ -50,26 +50,17 @@ public class DistanceFormatterUnitTests {
|
||||
|
||||
public static class UnparameterizedTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-279, DATACMNS-626
|
||||
public void rejectsArbitraryNonsense() {
|
||||
INSTANCE.convert("foo");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-279, DATACMNS-626
|
||||
public void rejectsUnsupportedMetric() {
|
||||
INSTANCE.convert("10.8cm");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-279, DATACMNS-626
|
||||
public void printsDistance() {
|
||||
assertThat(INSTANCE.print(REFERENCE, Locale.US), is("10.8km"));
|
||||
}
|
||||
@@ -87,10 +78,7 @@ public class DistanceFormatterUnitTests {
|
||||
|
||||
public @Parameter String source;
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-279, DATACMNS-626
|
||||
public void parsesDistanceFromString() {
|
||||
assertThat(INSTANCE.convert(source), is(REFERENCE));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -53,10 +53,7 @@ public class PointFormatterUnitTests {
|
||||
|
||||
public @Rule ExpectedException exception = ExpectedException.none();
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-279, DATACMNS-626
|
||||
public void rejectsArbitraryNonsense() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
@@ -65,18 +62,12 @@ public class PointFormatterUnitTests {
|
||||
INSTANCE.convert("foo");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-279, DATACMNS-626
|
||||
public void rejectsMoreThanTwoCoordinates() {
|
||||
INSTANCE.convert("10.8,20.9,30.10");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-279, DATACMNS-626
|
||||
public void rejectsInvalidCoordinate() {
|
||||
INSTANCE.convert("10.8,foo");
|
||||
}
|
||||
@@ -93,18 +84,12 @@ public class PointFormatterUnitTests {
|
||||
|
||||
public @Parameter String source;
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-279, DATACMNS-626
|
||||
public void convertsPointFromString() {
|
||||
assertThat(INSTANCE.convert(source), is(REFERENCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-279, DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-279, DATACMNS-626
|
||||
public void parsesPoint() throws ParseException {
|
||||
assertThat(INSTANCE.parse(source, Locale.US), is(REFERENCE));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -57,10 +57,7 @@ public class RevisionUnitTests {
|
||||
assertThat(revisions.get(1), is(second));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-187
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-187
|
||||
public void returnsRevisionNumber() {
|
||||
|
||||
when(firstMetadata.getRevisionNumber()).thenReturn(4711);
|
||||
@@ -70,10 +67,7 @@ public class RevisionUnitTests {
|
||||
assertThat(revision.getRevisionNumber(), is(4711));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-187
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-187
|
||||
public void returnsRevisionDate() {
|
||||
|
||||
DateTime reference = new DateTime();
|
||||
@@ -84,10 +78,7 @@ public class RevisionUnitTests {
|
||||
assertThat(revision.getRevisionDate(), is(reference));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-218
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-218
|
||||
public void returnsRevisionMetadata() {
|
||||
|
||||
Revision<Integer, Object> revision = new Revision<Integer, Object>(firstMetadata, new Object());
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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.
|
||||
@@ -43,27 +43,18 @@ import com.querydsl.core.types.dsl.StringPath;
|
||||
*/
|
||||
public class QSortUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-402
|
||||
public void shouldThrowIfNoOrderSpecifiersAreGiven() {
|
||||
new QSort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-402
|
||||
public void shouldThrowIfNullIsGiven() {
|
||||
new QSort((List<OrderSpecifier<?>>) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortBySingleProperty() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -74,11 +65,8 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("firstname"), is(new Sort.Order(Sort.Direction.ASC, "firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortByMultiplyProperties() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -91,11 +79,8 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortByMultiplyPropertiesWithAnd() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -108,11 +93,8 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortByMultiplyPropertiesWithAndAndVarArgs() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -125,10 +107,7 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void ensureInteroperabilityWithSort() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -140,10 +119,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void concatenatesPlainSortCorrectly() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -154,10 +130,7 @@ public class QSortUnitTests {
|
||||
assertThat(result, hasItems(new Order(Direction.ASC, "lastname"), new Order(Direction.ASC, "firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-566
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-566
|
||||
public void shouldSupportSortByOperatorExpressions() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -169,10 +142,7 @@ public class QSortUnitTests {
|
||||
new Order(Direction.ASC, user.dateOfBirth.yearMonth().toString())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-621
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-621
|
||||
public void shouldCreateSortForNestedPathCorrectly() {
|
||||
|
||||
QSort sort = new QSort(userWrapper.user.firstname.asc());
|
||||
@@ -180,10 +150,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-621
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-621
|
||||
public void shouldCreateSortForDeepNestedPathCorrectly() {
|
||||
|
||||
QSort sort = new QSort(wrapperForUserWrapper.wrapper.user.firstname.asc());
|
||||
@@ -191,10 +158,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "wrapper.user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-621
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-621
|
||||
public void shouldCreateSortForReallyDeepNestedPathCorrectly() {
|
||||
|
||||
QSort sort = new QSort(wrapperToWrapWrapperForUserWrapper.wrapperForUserWrapper.wrapper.user.firstname.asc());
|
||||
@@ -202,10 +166,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "wrapperForUserWrapper.wrapper.user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-755
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-755
|
||||
public void handlesPlainStringPathsCorrectly() {
|
||||
|
||||
StringPath path = new PathBuilderFactory().create(User.class).getString("firstname");
|
||||
|
||||
@@ -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.
|
||||
@@ -28,18 +28,12 @@ import org.junit.Test;
|
||||
*/
|
||||
public class QueryDslUtilsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-883
|
||||
public void rendersDotPathForPathTraversalContainingAnyExpression() {
|
||||
assertThat(toDotPath(QUser.user.addresses.any().street), is("addresses.street"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void skipsIntermediateDelegates() {
|
||||
|
||||
assertThat(toDotPath(QUser.user.as(QSpecialUser.class).as(QSpecialUser.class).specialProperty),
|
||||
|
||||
@@ -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.
|
||||
@@ -55,10 +55,7 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
|
||||
this.adapter = new QuerydslRepositoryInvokerAdapter(delegate, executor, predicate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void forwardsFindAllToExecutorWithPredicate() {
|
||||
|
||||
Sort sort = new Sort("firstname");
|
||||
@@ -68,10 +65,7 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
|
||||
verify(delegate, times(0)).invokeFindAll(sort);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void forwardsFindAllWithPageableToExecutorWithPredicate() {
|
||||
|
||||
PageRequest pageable = new PageRequest(0, 10);
|
||||
@@ -81,10 +75,7 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
|
||||
verify(delegate, times(0)).invokeFindAll(pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
public void forwardsMethodsToDelegate() {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -58,10 +58,7 @@ public class QuerydslBindingsFactoryUnitTests {
|
||||
this.factory = new QuerydslBindingsFactory(SimpleEntityPathResolver.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void createBindingsShouldHonorQuerydslBinderCustomizerHookWhenPresent() {
|
||||
|
||||
@@ -81,10 +78,7 @@ public class QuerydslBindingsFactoryUnitTests {
|
||||
is((Predicate) QUser.user.firstname.contains("rand")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldReuseExistingQuerydslBinderCustomizer() {
|
||||
|
||||
@@ -102,10 +96,7 @@ public class QuerydslBindingsFactoryUnitTests {
|
||||
is((Predicate) QUser.user.firstname.eq("RAND")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void rejectsPredicateResolutionIfDomainTypeCantBeAutoDetected() {
|
||||
|
||||
exception.expect(IllegalStateException.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -58,18 +58,12 @@ public class QuerydslBindingsUnitTests {
|
||||
this.bindings = new QuerydslBindings();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
public void rejectsNullPath() {
|
||||
bindings.getBindingForPath(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void returnsNullIfNoBindingRegisteredForPath() {
|
||||
|
||||
PathInformation path = PropertyPathInformation.of("lastname", User.class);
|
||||
@@ -77,10 +71,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.getBindingForPath(path), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void returnsRegisteredBindingForSimplePath() {
|
||||
|
||||
bindings.bind(QUser.user.firstname).first(CONTAINS_BINDING);
|
||||
@@ -90,10 +81,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(path), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void getBindingForPathShouldReturnSpeficicBindingForNestedElementsWhenAvailable() {
|
||||
|
||||
bindings.bind(QUser.user.address.street).first(CONTAINS_BINDING);
|
||||
@@ -103,10 +91,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(path), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void getBindingForPathShouldReturnSpeficicBindingForTypes() {
|
||||
|
||||
bindings.bind(String.class).first(CONTAINS_BINDING);
|
||||
@@ -116,10 +101,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(path), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void propertyNotExplicitlyIncludedAndWithoutTypeBindingIsInvisible() {
|
||||
|
||||
bindings.bind(String.class).first(CONTAINS_BINDING);
|
||||
@@ -129,10 +111,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.getBindingForPath(path), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfTypeBasedBindingWasRegistered() {
|
||||
|
||||
bindings.bind(String.class).first(CONTAINS_BINDING);
|
||||
@@ -140,10 +119,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("inceptionYear", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void explicitlyIncludedPathIsVisible() {
|
||||
|
||||
bindings.including(QUser.user.inceptionYear);
|
||||
@@ -151,10 +127,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("inceptionYear", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void notExplicitlyIncludedPathIsInvisible() {
|
||||
|
||||
bindings.including(QUser.user.inceptionYear);
|
||||
@@ -162,10 +135,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("firstname", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void excludedPathIsInvisible() {
|
||||
|
||||
bindings.excluding(QUser.user.inceptionYear);
|
||||
@@ -173,10 +143,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("inceptionYear", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfNotExplicitlyExcluded() {
|
||||
|
||||
bindings.excluding(QUser.user.inceptionYear);
|
||||
@@ -184,10 +151,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("firstname", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfItsBothBlackAndWhitelisted() {
|
||||
|
||||
bindings.excluding(QUser.user.firstname);
|
||||
@@ -196,10 +160,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("firstname", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void nestedPathIsInvisibleIfAParanetPathWasExcluded() {
|
||||
|
||||
bindings.excluding(QUser.user.address);
|
||||
@@ -207,10 +168,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfConcretePathIsVisibleButParentExcluded() {
|
||||
|
||||
bindings.excluding(QUser.user.address);
|
||||
@@ -219,10 +177,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void isPathVisibleShouldReturnFalseWhenPartialPathContainedInExcludingAndConcretePathToDifferentPropertyIsIncluded() {
|
||||
|
||||
bindings.excluding(QUser.user.address);
|
||||
@@ -231,10 +186,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.street", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void whitelistsPropertiesCorrectly() {
|
||||
|
||||
bindings.including(QUser.user.firstname, QUser.user.address.street);
|
||||
@@ -245,26 +197,17 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-787
|
||||
public void rejectsNullAlias() {
|
||||
bindings.bind(QUser.user.address).as(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-787
|
||||
public void rejectsEmptyAlias() {
|
||||
bindings.bind(QUser.user.address).as("");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-787
|
||||
public void aliasesBinding() {
|
||||
|
||||
bindings.bind(QUser.user.address.city).as("city").first(CONTAINS_BINDING);
|
||||
@@ -278,10 +221,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-787
|
||||
public void explicitlyIncludesOriginalBindingDespiteAlias() {
|
||||
|
||||
bindings.including(QUser.user.address.city);
|
||||
@@ -300,10 +240,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(propertyPath), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-787
|
||||
public void registedAliasWithNullBinding() {
|
||||
|
||||
bindings.bind(QUser.user.address.city).as("city").withDefaultBinding();
|
||||
@@ -315,10 +252,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(binding, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void registersBindingForPropertyOfSubtype() {
|
||||
|
||||
bindings.bind(QUser.user.as(QSpecialUser.class).specialProperty).first(ContainsBinding.INSTANCE);
|
||||
|
||||
@@ -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.
|
||||
@@ -44,10 +44,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
binding = new QuerydslDefaultBinding();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateCorrectlyWhenPropertyIsInRoot() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.firstname, Collections.singleton("tam"));
|
||||
@@ -55,10 +52,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
assertPredicate(predicate, is(QUser.user.firstname.eq("tam")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateCorrectlyWhenPropertyIsInNestedElement() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.address.city, Collections.singleton("two rivers"));
|
||||
@@ -66,10 +60,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
Assert.assertThat(predicate.toString(), is(QUser.user.address.city.eq("two rivers").toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateWithContainingWhenPropertyIsCollectionLikeAndValueIsObject() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.nickNames, Collections.singleton("dragon reborn"));
|
||||
@@ -77,10 +68,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
assertPredicate(predicate, is(QUser.user.nickNames.contains("dragon reborn")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateWithInWhenPropertyIsAnObjectAndValueIsACollection() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.firstname, Arrays.asList("dragon reborn", "shadowkiller"));
|
||||
|
||||
@@ -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.
|
||||
@@ -64,35 +64,23 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
this.values = new LinkedMultiValueMap<String, String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
public void rejectsNullConversionService() {
|
||||
new QuerydslPredicateBuilder(null, SimpleEntityPathResolver.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
public void getPredicateShouldThrowErrorWhenBindingContextIsNull() {
|
||||
builder.getPredicate(null, values, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void getPredicateShouldReturnEmptyPredicateWhenPropertiesAreEmpty() {
|
||||
|
||||
assertThat(builder.getPredicate(ClassTypeInformation.OBJECT, values, DEFAULT_BINDINGS), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void resolveArgumentShouldCreateSingleStringParameterPredicateCorrectly() throws Exception {
|
||||
|
||||
values.add("firstname", "Oliver");
|
||||
@@ -107,10 +95,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(result, hasItem(Users.OLIVER));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void resolveArgumentShouldCreateNestedStringParameterPredicateCorrectly() throws Exception {
|
||||
|
||||
values.add("address.city", "Linz");
|
||||
@@ -125,10 +110,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(result, hasItem(Users.CHRISTOPH));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void ignoresNonDomainTypeProperties() {
|
||||
|
||||
values.add("firstname", "rand");
|
||||
@@ -139,10 +121,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.firstname.eq("rand")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void forwardsNullForEmptyParameterToSingleValueBinder() {
|
||||
|
||||
values.add("lastname", null);
|
||||
@@ -159,10 +138,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
builder.getPredicate(USER_TYPE, values, bindings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-734
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-734
|
||||
@SuppressWarnings("unchecked")
|
||||
public void resolvesCommaSeparatedArgumentToArrayCorrectly() {
|
||||
|
||||
@@ -176,10 +152,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat((Double[]) (constant.getConstant()), arrayContaining(40.740337D, -73.995146D));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-734
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-734
|
||||
@SuppressWarnings("unchecked")
|
||||
public void leavesCommaSeparatedArgumentUntouchedWhenTargetIsNotAnArray() {
|
||||
|
||||
@@ -193,10 +166,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat((String) (constant.getConstant()), equalTo("rivers,two"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-734
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-734
|
||||
public void bindsDateCorrectly() throws ParseException {
|
||||
|
||||
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd");
|
||||
@@ -209,10 +179,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.dateOfBirth.eq(format.parseDateTime(date).toDate())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-883
|
||||
public void automaticallyInsertsAnyStepInCollectionReference() {
|
||||
|
||||
values.add("addresses.street", "VALUE");
|
||||
@@ -222,10 +189,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.addresses.any().street.eq("VALUE")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void buildsPredicateForBindingUsingDowncast() {
|
||||
|
||||
values.add("specialProperty", "VALUE");
|
||||
@@ -239,10 +203,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.as(QSpecialUser.class).specialProperty.contains("VALUE")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void buildsPredicateForBindingUsingNestedDowncast() {
|
||||
|
||||
values.add("user.specialProperty", "VALUE");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 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.
|
||||
@@ -102,10 +102,7 @@ public class CdiRepositoryBeanUnitTests {
|
||||
assertThat(stereotypes, hasItem(StereotypeAnnotation.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-299
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-299
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void scopeDefaultsToApplicationScoped() {
|
||||
|
||||
@@ -114,10 +111,7 @@ public class CdiRepositoryBeanUnitTests {
|
||||
assertThat(bean.getScope(), equalTo((Class) ApplicationScoped.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-322
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-322
|
||||
public void createsPassivationId() {
|
||||
|
||||
CdiRepositoryBean<SampleRepository> bean = new DummyCdiRepositoryBean<SampleRepository>(SINGLE_ANNOTATION,
|
||||
|
||||
@@ -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.
|
||||
@@ -36,10 +36,7 @@ public abstract class CdiRepositoryExtensionSupportIntegrationTests {
|
||||
assertThat(client.repository, is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-557
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-557
|
||||
public void createsSpringDataRepositoryWithCustimImplBean() {
|
||||
|
||||
assertThat(getBean(AnotherRepository.class), is(notNullValue()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 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.
|
||||
@@ -56,20 +56,14 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-47
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-47
|
||||
public void findsBasePackagesForClasses() {
|
||||
|
||||
Iterable<String> basePackages = source.getBasePackages();
|
||||
assertThat(basePackages, hasItem(AnnotationRepositoryConfigurationSourceUnitTests.class.getPackage().getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-47
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-47
|
||||
public void evaluatesExcludeFiltersCorrectly() {
|
||||
|
||||
Collection<BeanDefinition> candidates = source.getCandidates(new DefaultResourceLoader());
|
||||
@@ -79,10 +73,7 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
assertThat(candidate.getBeanClassName(), is(MyRepository.class.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-47
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-47
|
||||
public void defaultsToPackageOfAnnotatedClass() {
|
||||
|
||||
AnnotationRepositoryConfigurationSource source = getConfigSource(DefaultConfiguration.class);
|
||||
@@ -92,10 +83,7 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
assertThat(source.shouldConsiderNestedRepositories(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-47
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-47
|
||||
public void returnsConfiguredBasePackage() {
|
||||
|
||||
AnnotationRepositoryConfigurationSource source = getConfigSource(DefaultConfigurationWithBasePackage.class);
|
||||
@@ -104,30 +92,21 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
assertThat(packages, hasItem("foo"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-90
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-90
|
||||
public void returnsConsiderNestedRepositories() {
|
||||
|
||||
AnnotationRepositoryConfigurationSource source = getConfigSource(DefaultConfigurationWithNestedRepositories.class);
|
||||
assertThat(source.shouldConsiderNestedRepositories(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-456
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-456
|
||||
public void findsStringAttributeByName() {
|
||||
|
||||
RepositoryConfigurationSource source = getConfigSource(DefaultConfigurationWithBasePackage.class);
|
||||
assertThat(source.getAttribute("namedQueriesLocation"), is("bar"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-502
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-502
|
||||
public void returnsEmptyStringForBasePackage() throws Exception {
|
||||
|
||||
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(getClass().getClassLoader().loadClass(
|
||||
@@ -138,20 +117,14 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
assertThat(configurationSource.getBasePackages(), hasItem(""));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-526
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-526
|
||||
public void detectsExplicitFilterConfiguration() {
|
||||
|
||||
assertThat(getConfigSource(ConfigurationWithExplicitFilter.class).usesExplicitFilters(), is(true));
|
||||
assertThat(getConfigSource(DefaultConfiguration.class).usesExplicitFilters(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-542
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-542
|
||||
public void ignoresMissingRepositoryBaseClassNameAttribute() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(ConfigWithSampleAnnotation.class, true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 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.
|
||||
@@ -59,30 +59,21 @@ public class RepositoryBeanDefinitionRegistrarSupportIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-47
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-47
|
||||
public void testBootstrappingWithInheritedConfigClasses() {
|
||||
|
||||
assertThat(context.getBean(MyRepository.class), is(notNullValue()));
|
||||
assertThat(context.getBean(MyOtherRepository.class), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-47
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-47
|
||||
public void beanDefinitionSourceIsSetForJavaConfigScannedBeans() {
|
||||
|
||||
BeanDefinition definition = context.getBeanDefinition("myRepository");
|
||||
assertThat(definition.getSource(), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-544
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-544
|
||||
public void registersExtensionAsBeanDefinition() {
|
||||
assertThat(context.getBean(DummyConfigurationExtension.class), is(notNullValue()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 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.
|
||||
@@ -66,10 +66,7 @@ public class RepositoryBeanDefinitionRegistrarSupportUnitTests {
|
||||
assertNoBeanDefinitionRegisteredFor("profileRepository");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-360
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-360
|
||||
public void registeredProfileRepositoriesIfProfileActivated() {
|
||||
|
||||
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(SampleConfiguration.class, true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 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.
|
||||
@@ -64,10 +64,7 @@ public class RepositoryComponentProviderUnitTests {
|
||||
assertThat(components, hasItem(BeanDefinitionOfTypeMatcher.beanDefinitionOfType(MyOtherRepository.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @DATACMNS-90
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-90
|
||||
public void shouldConsiderNestedRepositoryInterfacesIfEnabled() {
|
||||
|
||||
RepositoryComponentProvider provider = new RepositoryComponentProvider(Collections.<TypeFilter> emptyList());
|
||||
|
||||
@@ -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.
|
||||
@@ -40,10 +40,7 @@ public class RepositoryConfigurationDelegateUnitTests {
|
||||
|
||||
@Mock RepositoryConfigurationExtension extension;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-892
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-892
|
||||
public void registersRepositoryBeanNameAsAttribute() {
|
||||
|
||||
StandardEnvironment environment = new StandardEnvironment();
|
||||
|
||||
@@ -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.
|
||||
@@ -38,30 +38,21 @@ public class RepositoryConfigurationExtensionSupportUnitTests {
|
||||
|
||||
RepositoryConfigurationExtensionSupport extension = new SampleRepositoryConfigurationExtension();
|
||||
|
||||
/**
|
||||
* @see DATACMNS-526
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-526
|
||||
public void doesNotConsiderRepositoryForPlainTypeStrictMatch() {
|
||||
|
||||
RepositoryMetadata metadata = AbstractRepositoryMetadata.getMetadata(PlainTypeRepository.class);
|
||||
assertThat(extension.isStrictRepositoryCandidate(metadata), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-526
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-526
|
||||
public void considersRepositoryWithAnnotatedTypeStrictMatch() {
|
||||
|
||||
RepositoryMetadata metadata = AbstractRepositoryMetadata.getMetadata(AnnotatedTypeRepository.class);
|
||||
assertThat(extension.isStrictRepositoryCandidate(metadata), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-526
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-526
|
||||
public void considersRepositoryInterfaceExtendingStoreInterfaceStrictMatch() {
|
||||
|
||||
RepositoryMetadata metadata = AbstractRepositoryMetadata.getMetadata(ExtendingInterface.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -39,10 +39,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
*/
|
||||
public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-333
|
||||
public void registersJackson2InitializerCorrectly() {
|
||||
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
@@ -61,10 +58,7 @@ public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTes
|
||||
assertIsListOfClasspathResourcesWithPath(resources, "org/springframework/data/repository/init/data.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-58
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-58
|
||||
public void registersXmlInitializerCorrectly() {
|
||||
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
|
||||
@@ -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.
|
||||
@@ -37,10 +37,7 @@ public class XmlRepositoryConfigurationSourceUnitTests {
|
||||
|
||||
@Mock Element element;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-456
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-456
|
||||
public void translatesCamelCaseAttributeNameIntoXmlEquivalent() {
|
||||
|
||||
RepositoryConfigurationSource source = mock(XmlRepositoryConfigurationSource.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 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.
|
||||
@@ -52,10 +52,7 @@ public class AbstractEntityInformationUnitTests {
|
||||
assertThat(metadata.isNew(new Object()), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-357
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-357
|
||||
public void detectsNewStateForPrimitiveIds() {
|
||||
|
||||
FooEn<PrimitiveIdEntity, Serializable> fooEn = new FooEn<PrimitiveIdEntity, Serializable>(PrimitiveIdEntity.class);
|
||||
@@ -67,10 +64,7 @@ public class AbstractEntityInformationUnitTests {
|
||||
assertThat(fooEn.isNew(entity), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-357
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-357
|
||||
public void detectsNewStateForPrimitiveWrapperIds() {
|
||||
|
||||
FooEn<PrimitiveWrapperIdEntity, Serializable> fooEn = new FooEn<PrimitiveWrapperIdEntity, Serializable>(
|
||||
@@ -83,10 +77,7 @@ public class AbstractEntityInformationUnitTests {
|
||||
assertThat(fooEn.isNew(entity), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-357
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-357
|
||||
public void rejectsUnsupportedPrimitiveIdType() {
|
||||
|
||||
FooEn<UnsupportedPrimitiveIdEntity, ?> information = new FooEn<UnsupportedPrimitiveIdEntity, Boolean>(
|
||||
|
||||
@@ -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.
|
||||
@@ -40,10 +40,7 @@ import org.springframework.data.repository.core.RepositoryMetadata;
|
||||
*/
|
||||
public class AbstractRepositoryMetadataUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-98
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-98
|
||||
public void discoversSimpleReturnTypeCorrectly() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(UserRepository.class);
|
||||
@@ -51,20 +48,14 @@ public class AbstractRepositoryMetadataUnitTests {
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-98
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-98
|
||||
public void resolvesTypeParameterReturnType() throws Exception {
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(ConcreteRepository.class);
|
||||
Method method = ConcreteRepository.class.getMethod("intermediateMethod");
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-98
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-98
|
||||
public void determinesReturnTypeFromPageable() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(ExtendingRepository.class);
|
||||
@@ -72,40 +63,28 @@ public class AbstractRepositoryMetadataUnitTests {
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-453
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-453
|
||||
public void nonPageableRepository() {
|
||||
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(UserRepository.class);
|
||||
assertThat(metadata.isPagingRepository(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-453
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-453
|
||||
public void pageableRepository() {
|
||||
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(PagedRepository.class);
|
||||
assertThat(metadata.isPagingRepository(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-98
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-98
|
||||
public void determinesReturnTypeFromGenericType() throws Exception {
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(ExtendingRepository.class);
|
||||
Method method = ExtendingRepository.class.getMethod("someMethod");
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(GenericType.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-98
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-98
|
||||
public void handlesGenericTypeInReturnedCollectionCorrectly() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
RepositoryMetadata metadata = new DummyRepositoryMetadata(ExtendingRepository.class);
|
||||
@@ -113,10 +92,7 @@ public class AbstractRepositoryMetadataUnitTests {
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(Map.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-471
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-471
|
||||
public void detectsArrayReturnTypeCorrectly() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(PagedRepository.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -69,10 +69,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
assertSaveMethodPresent(type, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-393
|
||||
public void selectsFindAllWithSortParameterOnRepositoryAmongUnsuitableAlternatives() throws Exception {
|
||||
|
||||
Class<RepositoryWithInvalidPagingFallbackToSortFindAll> type = RepositoryWithInvalidPagingFallbackToSortFindAll.class;
|
||||
@@ -98,10 +95,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
assertFindAllMethodOn(type, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-393
|
||||
public void detectsOverloadedMethodsCorrectly() throws Exception {
|
||||
|
||||
Class<RepositoryWithAllCrudMethodOverloaded> type = RepositoryWithAllCrudMethodOverloaded.class;
|
||||
@@ -111,10 +105,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
assertFindAllMethodOn(type, type.getDeclaredMethod("findAll"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-393
|
||||
public void ignoresWrongOverloadedMethods() throws Exception {
|
||||
|
||||
Class<RepositoryWithAllCrudMethodOverloadedWrong> type = RepositoryWithAllCrudMethodOverloadedWrong.class;
|
||||
@@ -124,28 +115,19 @@ public class DefaultCrudMethodsUnitTests {
|
||||
assertFindAllMethodOn(type, CrudRepository.class.getDeclaredMethod("findAll"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-464
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-464
|
||||
public void detectsCustomSaveMethod() throws Exception {
|
||||
assertSaveMethodOn(RepositoryWithCustomSave.class, RepositoryWithCustomSave.class.getMethod("save", Domain.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-539
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-539
|
||||
public void detectsOverriddenDeleteMethodForEntity() throws Exception {
|
||||
|
||||
assertDeleteMethodOn(RepositoryWithDeleteMethodForEntityOverloaded.class,
|
||||
RepositoryWithDeleteMethodForEntityOverloaded.class.getMethod("delete", Domain.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-619
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-619
|
||||
public void exposedMethodsAreAccessible() {
|
||||
|
||||
CrudMethods methods = getMethodsFor(RepositoryWithAllCrudMethodOverloaded.class);
|
||||
@@ -223,9 +205,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
Iterable<Domain> findAll(Pageable pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
// DATACMNS-393
|
||||
interface RepositoryWithCustomSortingFindAll extends Repository<Domain, Serializable> {
|
||||
|
||||
Iterable<Domain> findAll(Sort sort);
|
||||
@@ -236,9 +216,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
Iterable<Domain> findAll(Object pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
// DATACMNS-393
|
||||
interface RepositoryWithInvalidPagingFallbackToSortFindAll extends Repository<Domain, Serializable> {
|
||||
|
||||
Iterable<Domain> findAll(Object pageable);
|
||||
@@ -251,9 +229,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
void delete(Iterable<? extends Domain> entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
// DATACMNS-393
|
||||
interface RepositoryWithAllCrudMethodOverloaded extends CrudRepository<Domain, Long> {
|
||||
|
||||
List<Domain> findAll();
|
||||
@@ -265,9 +241,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
Domain findOne(Long id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-393
|
||||
*/
|
||||
// DATACMNS-393
|
||||
interface RepositoryWithAllCrudMethodOverloadedWrong extends CrudRepository<Domain, Long> {
|
||||
|
||||
List<Domain> findAll(String s);
|
||||
@@ -279,9 +253,7 @@ public class DefaultCrudMethodsUnitTests {
|
||||
Domain findOne(Domain o);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-539
|
||||
*/
|
||||
// DATACMNS-539
|
||||
interface RepositoryWithDeleteMethodForEntityOverloaded extends CrudRepository<Domain, Long> {
|
||||
|
||||
void delete(Domain entity);
|
||||
|
||||
@@ -123,10 +123,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getQueryMethods(), is(empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-151
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-151
|
||||
public void doesNotConsiderManuallyDefinedSaveMethodAQueryMethod() {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(CustomRepository.class);
|
||||
@@ -135,10 +132,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getQueryMethods(), is(IsEmptyIterable.<Method> emptyIterable()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-151
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-151
|
||||
public void doesNotConsiderRedeclaredSaveMethodAQueryMethod() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
|
||||
@@ -168,10 +162,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(queryMethods, not(hasItem(intermediateMethod)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-193
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-193
|
||||
public void detectsQueryMethodCorrectly() {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
|
||||
@@ -183,10 +174,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.isQueryMethod(queryMethod), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-364
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-364
|
||||
public void ignoresCrudMethodsAnnotatedWithQuery() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
|
||||
@@ -197,10 +185,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getQueryMethods(), hasItem(method));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-385
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-385
|
||||
public void findsTargetSaveForIterableIfEntityImplementsIterable() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(BossRepository.class);
|
||||
@@ -212,10 +197,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getTargetClassMethod(method), is(reference));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-441
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-441
|
||||
public void getQueryShouldNotReturnAnyBridgeMethods() {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(CustomDefaultRepositoryMethodsRepository.class);
|
||||
@@ -226,10 +208,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-854
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-854
|
||||
public void discoversCustomlyImplementedCrudMethodWithGenerics() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class);
|
||||
@@ -242,10 +221,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getTargetClassMethod(source), is(expected));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-912
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-912
|
||||
public void discoversCustomlyImplementedCrudMethodWithGenericParameters() throws Exception {
|
||||
|
||||
SampleRepositoryImpl customImplementation = new SampleRepositoryImpl();
|
||||
@@ -257,11 +233,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.isCustomMethod(customBaseRepositoryMethod), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-939
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-939
|
||||
public void ignoresStaticMethod() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class);
|
||||
@@ -273,10 +245,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getQueryMethods(), not(hasItem(method)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-939
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-939
|
||||
public void ignoresDefaultMethod() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class);
|
||||
@@ -288,11 +257,7 @@ public class DefaultRepositoryInformationUnitTests {
|
||||
assertThat(information.getQueryMethods(), not(hasItem(method)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-943
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-943
|
||||
public void usesCorrectSaveOverload() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(DummyRepository.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 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.
|
||||
@@ -56,10 +56,7 @@ public class DefaultRepositoryMetadataUnitTests {
|
||||
new DefaultRepositoryMetadata(Collection.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-406
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-406
|
||||
public void rejectsUnparameterizedRepositoryInterface() {
|
||||
new DefaultRepositoryMetadata(Repository.class);
|
||||
}
|
||||
@@ -95,20 +92,14 @@ public class DefaultRepositoryMetadataUnitTests {
|
||||
assertEquals(Integer.class, metadata.getIdType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-442
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-442
|
||||
public void detectsIdTypeOnIntermediateRepository() {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
|
||||
assertEquals(Long.class, metadata.getIdType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-483
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-483
|
||||
public void discoversDomainTypeOnReturnTypeWrapper() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(OptionalRepository.class);
|
||||
@@ -117,10 +108,7 @@ public class DefaultRepositoryMetadataUnitTests {
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-483
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-483
|
||||
public void discoversDomainTypeOnNestedReturnTypeWrapper() throws Exception {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(OptionalRepository.class);
|
||||
@@ -129,10 +117,7 @@ public class DefaultRepositoryMetadataUnitTests {
|
||||
assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-501
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-501
|
||||
public void discoversDomainAndIdTypeForIntermediateRepository() {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(IdTypeFixingRepository.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -55,26 +55,17 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
@Mock ApplicationEventPublisher publisher;
|
||||
@Mock MethodInvocation invocation;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-928
|
||||
public void rejectsNullAggregateTypes() {
|
||||
EventPublishingMethod.of(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void publishingEventsForNullIsNoOp() {
|
||||
EventPublishingMethod.of(OneEvent.class).publishEventsFrom(null, publisher);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void exposesEventsExposedByEntityToPublisher() {
|
||||
|
||||
SomeEvent first = new SomeEvent();
|
||||
@@ -87,10 +78,7 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(publisher).publishEvent(eq(second));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void exposesSingleEventByEntityToPublisher() {
|
||||
|
||||
SomeEvent event = new SomeEvent();
|
||||
@@ -101,10 +89,7 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(publisher, times(1)).publishEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void doesNotExposeNullEvent() {
|
||||
|
||||
OneEvent entity = OneEvent.of(null);
|
||||
@@ -114,18 +99,12 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(publisher, times(0)).publishEvent(any());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void doesNotCreatePublishingMethodIfNoAnnotationDetected() {
|
||||
assertThat(EventPublishingMethod.of(Object.class), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void interceptsSaveMethod() throws Throwable {
|
||||
|
||||
doReturn(SampleRepository.class.getMethod("save", Object.class)).when(invocation).getMethod();
|
||||
@@ -141,10 +120,7 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(publisher).publishEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void doesNotInterceptNonSaveMethod() throws Throwable {
|
||||
|
||||
doReturn(SampleRepository.class.getMethod("findOne", Serializable.class)).when(invocation).getMethod();
|
||||
@@ -156,10 +132,7 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(publisher, never()).publishEvent(any());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void registersAdviceIfDomainTypeExposesEvents() {
|
||||
|
||||
RepositoryInformation information = new DummyRepositoryInformation(SampleRepository.class);
|
||||
@@ -172,10 +145,7 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(factory).addAdvice(any(EventPublishingMethodInterceptor.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void doesNotAddAdviceIfDomainTypeDoesNotExposeEvents() {
|
||||
|
||||
RepositoryInformation information = new DummyRepositoryInformation(CrudRepository.class);
|
||||
@@ -188,10 +158,7 @@ public class EventPublishingRepositoryProxyPostProcessorUnitTests {
|
||||
verify(factory, never()).addAdvice(any(Advice.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-928
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-928
|
||||
public void publishesEventsForCallToSaveWithIterable() throws Throwable {
|
||||
|
||||
SomeEvent event = new SomeEvent();
|
||||
|
||||
@@ -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.
|
||||
@@ -54,18 +54,12 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
exampleSpecificationAccessor = new ExampleMatcherAccessor(specification);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void defaultStringMatcherShouldReturnDefault() {
|
||||
assertThat(exampleSpecificationAccessor.getDefaultStringMatcher(), is(StringMatcher.DEFAULT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void nullHandlerShouldReturnInclude() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -75,10 +69,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getNullHandler(), is(NullHandler.INCLUDE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldIgnorePaths() {
|
||||
|
||||
specification = ExampleMatcher.matching().withIgnorePaths("firstname");
|
||||
@@ -88,19 +79,13 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.isIgnoredPath("lastname"), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseDefaultStringMatcherForPathThatDoesNotHavePropertySpecifier() {
|
||||
assertThat(exampleSpecificationAccessor.getStringMatcherForPath("firstname"),
|
||||
is(specification.getDefaultStringMatcher()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseConfiguredStringMatcherAsDefaultForPathThatDoesNotHavePropertySpecifier() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -111,10 +96,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getStringMatcherForPath("firstname"), is(StringMatcher.CONTAINING));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseDefaultIgnoreCaseForPathThatDoesHavePropertySpecifierWithMatcher() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -126,10 +108,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.isIgnoreCaseForPath("firstname"), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseConfiguredIgnoreCaseForPathThatDoesHavePropertySpecifierWithMatcher() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -141,10 +120,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.isIgnoreCaseForPath("firstname"), equalTo(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseDefinedStringMatcherForPathThatDoesHavePropertySpecifierWithStringMatcherStarting() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -155,10 +131,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getStringMatcherForPath("firstname"), equalTo(StringMatcher.STARTING));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseDefinedStringMatcherForPathThatDoesHavePropertySpecifierWithStringMatcherContaining() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -169,10 +142,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getStringMatcherForPath("firstname"), equalTo(StringMatcher.CONTAINING));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseDefinedStringMatcherForPathThatDoesHavePropertySpecifierWithStringMatcherRegex() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -183,10 +153,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getStringMatcherForPath("firstname"), equalTo(StringMatcher.REGEX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldFavorStringMatcherDefinedForPathOverConfiguredDefaultStringMatcher() {
|
||||
|
||||
specification = ExampleMatcher.matching().withStringMatcher(StringMatcher.ENDING)
|
||||
@@ -206,10 +173,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getStringMatcherForPath("unknownProperty"), equalTo(StringMatcher.ENDING));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void exampleShouldUseDefaultStringMatcherForPathThatHasPropertySpecifierWithoutStringMatcher() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -228,20 +192,14 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.isIgnoreCaseForPath("unknownProperty"), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoreCaseShouldReturnFalseByDefault() {
|
||||
|
||||
assertThat(specification.isIgnoreCaseEnabled(), is(false));
|
||||
assertThat(exampleSpecificationAccessor.isIgnoreCaseForPath("firstname"), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoreCaseShouldReturnTrueWhenIgnoreCaseIsEnabled() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -253,10 +211,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.isIgnoreCaseForPath("firstname"), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void ignoreCaseShouldFavorPathSpecificSettings() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -268,19 +223,13 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.isIgnoreCaseForPath("firstname"), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void getValueTransformerForPathReturnsNoOpValueTransformerByDefault() {
|
||||
assertThat(exampleSpecificationAccessor.getValueTransformerForPath("firstname"),
|
||||
instanceOf(NoOpPropertyValueTransformer.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void getValueTransformerForPathReturnsConfigurtedTransformerForPath() {
|
||||
|
||||
PropertyValueTransformer transformer = new PropertyValueTransformer() {
|
||||
@@ -298,18 +247,12 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.getValueTransformerForPath("firstname"), equalTo(transformer));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void hasPropertySpecifiersReturnsFalseIfNoneDefined() {
|
||||
assertThat(exampleSpecificationAccessor.hasPropertySpecifiers(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-810
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-810
|
||||
public void hasPropertySpecifiersReturnsTrueWhenAtLeastOneIsSet() {
|
||||
|
||||
specification = ExampleMatcher.matching().//
|
||||
@@ -321,10 +264,7 @@ public class ExampleSpecificationAccessorUnitTests {
|
||||
assertThat(exampleSpecificationAccessor.hasPropertySpecifiers(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-953
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-953
|
||||
public void exactMatcherUsesExactMatching() {
|
||||
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()//
|
||||
|
||||
@@ -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. You may obtain a copy of
|
||||
@@ -52,19 +52,13 @@ public class PersistenceExceptionTranslationRepositoryProxyPostProcessorUnitTest
|
||||
beans);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-318
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-318
|
||||
public void rejectsNullBeanFactory() throws Exception {
|
||||
|
||||
new PersistenceExceptionTranslationRepositoryProxyPostProcessor(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-318
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-318
|
||||
public void setsUpBasicInstance() throws Exception {
|
||||
|
||||
RepositoryProxyPostProcessor postProcessor = new PersistenceExceptionTranslationRepositoryProxyPostProcessor(
|
||||
|
||||
@@ -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.
|
||||
@@ -34,10 +34,7 @@ import org.springframework.data.repository.core.EntityInformation;
|
||||
*/
|
||||
public class PersistentEntityInformationUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-480
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-480
|
||||
public void obtainsIdAndIdTypeInformationFromPersistentEntity() {
|
||||
|
||||
SampleMappingContext context = new SampleMappingContext();
|
||||
@@ -52,10 +49,7 @@ public class PersistentEntityInformationUnitTests {
|
||||
assertThat(information.getId(sample), is(5L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-596
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-596
|
||||
public void returnsNullIfNoIdPropertyPresent() {
|
||||
|
||||
SampleMappingContext context = new SampleMappingContext();
|
||||
|
||||
@@ -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.
|
||||
@@ -48,10 +48,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
|
||||
QueryExecutionResultHandler handler = new QueryExecutionResultHandler();
|
||||
|
||||
/**
|
||||
* @see DATACMNS-610
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-610
|
||||
public void convertsListsToSet() throws Exception {
|
||||
|
||||
TypeDescriptor descriptor = getTypeDescriptorFor("set");
|
||||
@@ -60,20 +57,14 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(handler.postProcessInvocationResult(source, descriptor), is(instanceOf(Set.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-483
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-483
|
||||
public void turnsNullIntoJdk8Optional() throws Exception {
|
||||
|
||||
Object result = handler.postProcessInvocationResult(null, getTypeDescriptorFor("jdk8Optional"));
|
||||
assertThat(result, is((Object) Optional.empty()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-483
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-483
|
||||
@SuppressWarnings("unchecked")
|
||||
public void wrapsValueIntoJdk8Optional() throws Exception {
|
||||
|
||||
@@ -86,20 +77,14 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(optional, is(Optional.of(entity)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-483
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-483
|
||||
public void turnsNullIntoGuavaOptional() throws Exception {
|
||||
|
||||
Object result = handler.postProcessInvocationResult(null, getTypeDescriptorFor("guavaOptional"));
|
||||
assertThat(result, is((Object) com.google.common.base.Optional.absent()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-483
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-483
|
||||
@SuppressWarnings("unchecked")
|
||||
public void wrapsValueIntoGuavaOptional() throws Exception {
|
||||
|
||||
@@ -112,18 +97,12 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(optional, is(com.google.common.base.Optional.of(entity)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-917
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-917
|
||||
public void defaultsNullToEmptyMap() throws Exception {
|
||||
assertThat(handler.postProcessInvocationResult(null, getTypeDescriptorFor("map")), is(instanceOf(Map.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaSingleIntoPublisher() throws Exception {
|
||||
|
||||
@@ -136,10 +115,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(mono.block(), is(entity.toBlocking().value()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaSingleIntoMono() throws Exception {
|
||||
|
||||
@@ -152,10 +128,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(mono.block(), is(entity.toBlocking().value()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaSingleIntoFlux() throws Exception {
|
||||
|
||||
@@ -168,10 +141,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(flux.next().block(), is(entity.toBlocking().value()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaObservableIntoPublisher() throws Exception {
|
||||
|
||||
@@ -184,10 +154,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(mono.block(), is(entity.toBlocking().first()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaObservableIntoMono() throws Exception {
|
||||
|
||||
@@ -200,10 +167,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(mono.block(), is(entity.toBlocking().first()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaObservableIntoFlux() throws Exception {
|
||||
|
||||
@@ -216,10 +180,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(flux.next().block(), is(entity.toBlocking().first()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaObservableIntoSingle() throws Exception {
|
||||
|
||||
@@ -232,10 +193,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(single.toBlocking().value(), is(entity.toBlocking().first()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaSingleIntoObservable() throws Exception {
|
||||
|
||||
@@ -248,10 +206,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(observable.toBlocking().first(), is(entity.toBlocking().value()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorMonoIntoSingle() throws Exception {
|
||||
|
||||
@@ -264,10 +219,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(single.toBlocking().value(), is(entity.block()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorMonoIntoCompletable() throws Exception {
|
||||
|
||||
@@ -280,10 +232,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(completable.get(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorMonoIntoCompletableWithException() throws Exception {
|
||||
|
||||
@@ -296,10 +245,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(completable.get(), is(instanceOf(InvalidDataAccessApiUsageException.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaCompletableIntoMono() throws Exception {
|
||||
|
||||
@@ -312,10 +258,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(mono.block(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class) // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsRxJavaCompletableIntoMonoWithException() throws Exception {
|
||||
|
||||
@@ -329,10 +272,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
fail("Missing InvalidDataAccessApiUsageException");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorMonoIntoObservable() throws Exception {
|
||||
|
||||
@@ -345,10 +285,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(observable.toBlocking().first(), is(entity.block()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorFluxIntoSingle() throws Exception {
|
||||
|
||||
@@ -361,10 +298,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(single.toBlocking().value(), is(entity.next().block()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorFluxIntoObservable() throws Exception {
|
||||
|
||||
@@ -377,10 +311,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(observable.toBlocking().first(), is(entity.next().block()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorFluxIntoMono() throws Exception {
|
||||
|
||||
@@ -393,10 +324,7 @@ public class QueryExecutionResultHandlerUnitTests {
|
||||
assertThat(mono.block(), is(entity.next().block()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void convertsReactorMonoIntoFlux() throws Exception {
|
||||
|
||||
|
||||
@@ -43,10 +43,7 @@ public class ReactiveRepositoryInformationUnitTests {
|
||||
|
||||
static final Class<ReactiveJavaInterfaceWithGenerics> REPOSITORY = ReactiveJavaInterfaceWithGenerics.class;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void discoversMethodWithoutComparingReturnType() throws Exception {
|
||||
|
||||
Method method = RxJava1InterfaceWithGenerics.class.getMethod("deleteAll");
|
||||
@@ -58,10 +55,7 @@ public class ReactiveRepositoryInformationUnitTests {
|
||||
assertThat(reference.getName(), is("deleteAll"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void discoversMethodWithConvertibleArguments() throws Exception {
|
||||
|
||||
Method method = RxJava1InterfaceWithGenerics.class.getMethod("save", Observable.class);
|
||||
@@ -74,10 +68,7 @@ public class ReactiveRepositoryInformationUnitTests {
|
||||
assertThat(reference.getParameterTypes()[0], is(equalTo(Publisher.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void discoversMethodAssignableArguments() throws Exception {
|
||||
|
||||
Method method = ReactiveSortingRepository.class.getMethod("save", Publisher.class);
|
||||
@@ -90,10 +81,7 @@ public class ReactiveRepositoryInformationUnitTests {
|
||||
assertThat(reference.getParameterTypes()[0], is(equalTo(Publisher.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void discoversMethodExactIterableArguments() throws Exception {
|
||||
|
||||
Method method = ReactiveJavaInterfaceWithGenerics.class.getMethod("save", Iterable.class);
|
||||
@@ -106,10 +94,7 @@ public class ReactiveRepositoryInformationUnitTests {
|
||||
assertThat(reference.getParameterTypes()[0], is(equalTo(Iterable.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void discoversMethodExactObjectArguments() throws Exception {
|
||||
|
||||
Method method = ReactiveJavaInterfaceWithGenerics.class.getMethod("save", Object.class);
|
||||
|
||||
@@ -53,10 +53,7 @@ public class ReactiveWrapperRepositoryFactorySupportUnitTests {
|
||||
factory = new DummyRepositoryFactory(backingRepo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void invokesCustomMethodIfItRedeclaresACRUDOne() {
|
||||
|
||||
ObjectRepository repository = factory.getRepository(ObjectRepository.class, customImplementation);
|
||||
@@ -66,10 +63,7 @@ public class ReactiveWrapperRepositoryFactorySupportUnitTests {
|
||||
verify(backingRepo, times(0)).findOne(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void callsMethodOnBaseImplementationWithExactArguments() {
|
||||
|
||||
Serializable id = 1L;
|
||||
@@ -79,10 +73,7 @@ public class ReactiveWrapperRepositoryFactorySupportUnitTests {
|
||||
verify(backingRepo, times(1)).exists(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void doesNotCallMethodOnBaseEvenIfDeclaredTypeCouldBeConverted() {
|
||||
|
||||
Long id = 1L;
|
||||
@@ -92,10 +83,7 @@ public class ReactiveWrapperRepositoryFactorySupportUnitTests {
|
||||
verifyZeroInteractions(backingRepo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
@SuppressWarnings("unchecked")
|
||||
public void callsMethodOnBaseImplementationWithTypeConversion() {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 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
|
||||
@@ -40,18 +40,12 @@ public class ReflectionEntityInformationUnitTests {
|
||||
assertThat(information.getIdType(), is(typeCompatibleWith(String.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-170
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-170
|
||||
public void rejectsTypeWithoutAnnotatedField() {
|
||||
getEntityInformation(Unannotated.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-357
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-357
|
||||
public void detectsNewStateForEntitiesWithPrimitiveIds() {
|
||||
|
||||
PrimitiveId primitiveId = new PrimitiveId();
|
||||
|
||||
@@ -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.
|
||||
@@ -35,10 +35,7 @@ public class RepositoryFactoryBeanSupportUnitTests {
|
||||
|
||||
public @Rule ExpectedException exception = ExpectedException.none();
|
||||
|
||||
/**
|
||||
* @see DATACMNS-341
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-341
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void setsConfiguredClassLoaderOnRepositoryFactory() {
|
||||
|
||||
@@ -53,10 +50,7 @@ public class RepositoryFactoryBeanSupportUnitTests {
|
||||
assertThat(ReflectionTestUtils.getField(factory, "classLoader"), is((Object) classLoader));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-432
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-432
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void initializationFailsWithMissingRepositoryInterface() {
|
||||
|
||||
|
||||
@@ -147,20 +147,14 @@ public class RepositoryFactorySupportUnitTests {
|
||||
assertThat(factory.getRepository(foo), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-341
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-341
|
||||
public void usesDefaultClassLoaderIfNullConfigured() {
|
||||
|
||||
factory.setBeanClassLoader(null);
|
||||
assertThat(ReflectionTestUtils.getField(factory, "classLoader"), is((Object) ClassUtils.getDefaultClassLoader()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-489
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-489
|
||||
public void wrapsExecutionResultIntoFutureIfConfigured() throws Exception {
|
||||
|
||||
final Object reference = new Object();
|
||||
@@ -192,10 +186,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
verify(factory.queryOne, times(1)).execute(Mockito.any(Object[].class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-509
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-509
|
||||
public void convertsWithSameElementType() {
|
||||
|
||||
List<String> names = Collections.singletonList("Dave");
|
||||
@@ -209,10 +200,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
assertThat(result.iterator().next(), is("Dave"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-509
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-509
|
||||
public void convertsCollectionToOtherCollectionWithElementSuperType() {
|
||||
|
||||
List<String> names = Collections.singletonList("Dave");
|
||||
@@ -226,10 +214,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
assertThat(result.iterator().next(), is((Object) "Dave"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-656
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-656
|
||||
public void rejectsNullRepositoryProxyPostProcessor() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
@@ -238,10 +223,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
factory.addRepositoryProxyPostProcessor(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-715, SPR-13109
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-715, SPR-13109
|
||||
public void addsTransactionProxyInterfaceIfAvailable() throws Exception {
|
||||
|
||||
try {
|
||||
@@ -256,10 +238,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see @see DATACMNS-714
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-714
|
||||
public void wrapsExecutionResultIntoCompletableFutureIfConfigured() throws Exception {
|
||||
|
||||
assumeThat(SPRING_VERSION.isGreaterThanOrEqualTo(FOUR_DOT_TWO), is(true));
|
||||
@@ -269,10 +248,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
expect(prepareConvertingRepository(reference).findOneByFirstname("Foo"), reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see @see DATACMNS-714
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-714
|
||||
public void wrapsExecutionResultIntoListenableFutureIfConfigured() throws Exception {
|
||||
|
||||
assumeThat(SPRING_VERSION.isGreaterThanOrEqualTo(FOUR_DOT_TWO), is(true));
|
||||
@@ -282,10 +258,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
expect(prepareConvertingRepository(reference).findOneByLastname("Foo"), reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see @see DATACMNS-714
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-714
|
||||
public void wrapsExecutionResultIntoCompletableFutureWithEntityCollectionIfConfigured() throws Exception {
|
||||
|
||||
assumeThat(SPRING_VERSION.isGreaterThanOrEqualTo(FOUR_DOT_TWO), is(true));
|
||||
@@ -295,10 +268,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
expect(prepareConvertingRepository(reference).readAllByFirstname("Foo"), reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-714
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-714
|
||||
public void wrapsExecutionResultIntoListenableFutureWithEntityCollectionIfConfigured() throws Exception {
|
||||
|
||||
assumeThat(SPRING_VERSION.isGreaterThanOrEqualTo(FOUR_DOT_TWO), is(true));
|
||||
@@ -308,10 +278,7 @@ public class RepositoryFactorySupportUnitTests {
|
||||
expect(prepareConvertingRepository(reference).readAllByLastname("Foo"), reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-763
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-763
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void rejectsRepositoryBaseClassWithInvalidConstructor() {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -31,10 +31,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
*/
|
||||
public class SurroundingTransactionDetectorMethodInterceptorUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-959
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-959
|
||||
public void registersActiveSurroundingTransaction() throws Throwable {
|
||||
|
||||
TransactionSynchronizationManager.setActualTransactionActive(true);
|
||||
@@ -42,10 +39,7 @@ public class SurroundingTransactionDetectorMethodInterceptorUnitTests {
|
||||
INSTANCE.invoke(new StubMethodInvocation(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-959
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-959
|
||||
public void registersNoSurroundingTransaction() throws Throwable {
|
||||
|
||||
TransactionSynchronizationManager.setActualTransactionActive(false);
|
||||
|
||||
@@ -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.
|
||||
@@ -36,10 +36,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||
*/
|
||||
public class TransactionRepositoryFactoryBeanSupportUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-656
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-656
|
||||
public void disablesDefaultTransactionsIfConfigured() {
|
||||
|
||||
SampleTransactionalRepositoryFactoryBean factoryBean = new SampleTransactionalRepositoryFactoryBean();
|
||||
@@ -68,10 +65,7 @@ public class TransactionRepositoryFactoryBeanSupportUnitTests {
|
||||
assertThat(found, is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-880
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-880
|
||||
public void propagatesBeanFactoryToSuperClass() {
|
||||
|
||||
SampleTransactionalRepositoryFactoryBean factoryBean = new SampleTransactionalRepositoryFactoryBean();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2015 the original author or authors.
|
||||
* Copyright 2008-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. You may obtain a copy of
|
||||
@@ -83,26 +83,17 @@ public class TransactionRepositoryProxyPostProcessorUnitTests {
|
||||
verify(proxyFactory).addAdvice(Mockito.any(TransactionInterceptor.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-464
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-464
|
||||
public void fallsBackToTargetMethodTransactionSettings() throws Exception {
|
||||
assertTransactionAttributeFor(SampleImplementation.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-464
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-464
|
||||
public void fallsBackToTargetClassTransactionSettings() throws Exception {
|
||||
assertTransactionAttributeFor(SampleImplementationWithClassAnnotation.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-732
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-732
|
||||
public void considersJtaTransactional() throws Exception {
|
||||
|
||||
Method method = SampleRepository.class.getMethod("methodWithJtaOneDotTwoAtTransactional");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 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.
|
||||
@@ -79,10 +79,7 @@ public class ResourceReaderRepositoryInitializerUnitTests {
|
||||
verify(productRepository, times(1)).save(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-224
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-224
|
||||
public void emitsRepositoriesPopulatedEventIfPublisherConfigured() throws Exception {
|
||||
|
||||
RepositoryPopulator populator = setUpReferenceAndInititalize(new User(), publisher);
|
||||
|
||||
@@ -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.
|
||||
@@ -57,10 +57,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
this.provider = new ExtensionAwareEvaluationContextProvider(Collections.<EvaluationContextExtension> emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void usesPropertyDefinedByExtension() {
|
||||
|
||||
this.provider = new ExtensionAwareEvaluationContextProvider(Collections.singletonList(new DummyExtension("_first",
|
||||
@@ -69,10 +66,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("key"), is((Object) "first"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void secondExtensionOverridesFirstOne() {
|
||||
|
||||
List<EvaluationContextExtension> extensions = new ArrayList<EvaluationContextExtension>();
|
||||
@@ -84,10 +78,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("key"), is((Object) "second"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void allowsDirectAccessToExtensionViaKey() {
|
||||
|
||||
List<EvaluationContextExtension> extensions = new ArrayList<EvaluationContextExtension>();
|
||||
@@ -98,18 +89,12 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("_first.key"), is((Object) "first"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void exposesParametersAsVariables() {
|
||||
assertThat(evaluateExpression("#firstname"), is((Object) "parameterValue"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void exposesMethodDefinedByExtension() {
|
||||
|
||||
this.provider = new ExtensionAwareEvaluationContextProvider(Collections.singletonList(new DummyExtension("_first",
|
||||
@@ -121,10 +106,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("_first.aliasedMethod()"), is((Object) "methodResult"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void exposesPropertiesDefinedByExtension() {
|
||||
|
||||
this.provider = new ExtensionAwareEvaluationContextProvider(Collections.singletonList(new DummyExtension("_first",
|
||||
@@ -134,10 +116,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("_first.DUMMY_KEY"), is((Object) "dummy"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void exposesPageableParameter() throws Exception {
|
||||
|
||||
this.method = SampleRepo.class.getMethod("findByFirstname", String.class, Pageable.class);
|
||||
@@ -149,10 +128,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
is((Object) "lastname: DESC"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void exposesSortParameter() throws Exception {
|
||||
|
||||
this.method = SampleRepo.class.getMethod("findByFirstname", String.class, Sort.class);
|
||||
@@ -161,10 +137,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("#sort.toString()", new Object[] { "test", sort }), is((Object) "lastname: DESC"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void exposesSpecialParameterEvenIfItsNull() throws Exception {
|
||||
|
||||
this.method = SampleRepo.class.getMethod("findByFirstname", String.class, Sort.class);
|
||||
@@ -172,10 +145,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("#sort?.toString()", new Object[] { "test", null }), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void shouldBeAbleToAccessCustomRootObjectPropertiesAndFunctions() {
|
||||
|
||||
this.provider = new ExtensionAwareEvaluationContextProvider(Collections.singletonList( //
|
||||
@@ -197,10 +167,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("_first.stringProperty"), is((Object) "stringProperty"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void shouldBeAbleToAccessCustomRootObjectPropertiesAndFunctionsInMultipleExtensions() {
|
||||
|
||||
this.provider = new ExtensionAwareEvaluationContextProvider(Arrays.asList( //
|
||||
@@ -226,10 +193,7 @@ public class ExtensionAwareEvaluationContextProviderUnitTests {
|
||||
assertThat(evaluateExpression("[0]"), is((Object) "parameterValue"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-533
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-533
|
||||
public void shouldBeAbleToAccessCustomRootObjectPropertiesAndFunctionsFromDynamicTargetSource() {
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger();
|
||||
|
||||
@@ -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.
|
||||
@@ -66,10 +66,7 @@ public class ParametersParameterAccessorUnitTests {
|
||||
assertThat(accessor.hasBindableNullValue(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-804
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-804
|
||||
public void iteratesonlyOverBindableValues() throws Exception {
|
||||
|
||||
Method method = Sample.class.getMethod("method", Pageable.class, String.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2016 the original author or authors.
|
||||
* Copyright 2008-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. You may obtain a copy of
|
||||
@@ -120,18 +120,12 @@ public class ParametersUnitTests {
|
||||
assertThat(parameters.getSortIndex(), is(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-520
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-520
|
||||
public void doesNotRejectParameterIfPageableComesFirst() throws Exception {
|
||||
getParametersFor("validWithPageableFirst", Pageable.class, String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-731
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-731
|
||||
public void detectsExplicitlyNamedParameter() throws Exception {
|
||||
|
||||
Parameter parameter = getParametersFor("valid", String.class).getBindableParameter(0);
|
||||
@@ -140,10 +134,7 @@ public class ParametersUnitTests {
|
||||
assertThat(parameter.isExplicitlyNamed(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-731
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-731
|
||||
public void doesNotConsiderParameterExplicitlyNamedEvenIfNamePresent() throws Exception {
|
||||
|
||||
Parameter parameter = getParametersFor("validWithSortFirst", Sort.class, String.class).getBindableParameter(0);
|
||||
@@ -155,10 +146,7 @@ public class ParametersUnitTests {
|
||||
assertThat(parameter.isExplicitlyNamed(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-89
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-89
|
||||
public void detectsDynamicProjectionParameter() throws Exception {
|
||||
|
||||
Parameters<?, Parameter> parameters = getParametersFor("dynamicBind", Class.class, Class.class, Class.class);
|
||||
@@ -168,10 +156,7 @@ public class ParametersUnitTests {
|
||||
assertThat(parameters.getParameter(2).isDynamicProjectionParameter(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-863
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-863
|
||||
public void unwrapsOptionals() throws Exception {
|
||||
|
||||
Parameters<?, Parameter> parameters = getParametersFor("methodWithOptional", Optional.class);
|
||||
@@ -179,10 +164,7 @@ public class ParametersUnitTests {
|
||||
assertThat(parameters.getParameter(0).getType(), is(typeCompatibleWith(String.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void keepsReactiveStreamsWrapper() throws Exception {
|
||||
|
||||
Parameters<?, Parameter> parameters = getParametersFor("methodWithPublisher", Publisher.class);
|
||||
@@ -190,10 +172,7 @@ public class ParametersUnitTests {
|
||||
assertThat(parameters.getParameter(0).getType(), is(typeCompatibleWith(Publisher.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-836
|
||||
public void keepsRxJavaWrapper() throws Exception {
|
||||
|
||||
Parameters<?, Parameter> parameters = getParametersFor("methodWithSingle", Single.class);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user