diff --git a/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderUnitTests.java b/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderUnitTests.java index 2be86e958..e192fffc3 100644 --- a/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderUnitTests.java +++ b/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderUnitTests.java @@ -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. @@ -24,10 +24,7 @@ import org.junit.Test; */ public class MongoLog4jAppenderUnitTests { - /** - * @see DATAMONGO-641 - */ - @Test + @Test // DATAMONGO-641 public void closesWithoutMongoInstancePresent() { new MongoLog4jAppender().close(); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java index 7047995a3..bb78d33fe 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java @@ -328,7 +328,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App Assert.isTrue(annotation != null, "The referenced property has to be mapped with @DBRef!"); } - // @see DATAMONGO-913 + // DATAMONGO-913 if (object instanceof LazyLoadingProxy) { return ((LazyLoadingProxy) object).toDBRef(); } diff --git a/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackage.java b/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackage.java index 4a77bc00e..45ae3b790 100644 --- a/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackage.java +++ b/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackage.java @@ -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. @@ -22,7 +22,6 @@ import com.mongodb.MongoClient; /** * Sample configuration class in default package. * - * @see DATAMONGO-877 * @author Oliver Gierke */ @Configuration diff --git a/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackageUnitTests.java b/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackageUnitTests.java index f9b9a78ca..4e8b9f25d 100644 --- a/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackageUnitTests.java +++ b/spring-data-mongodb/src/test/java/ConfigClassInDefaultPackageUnitTests.java @@ -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. @@ -19,15 +19,11 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext /** * Unit test for {@link ConfigClassInDefaultPackage}. * - * @see DATAMONGO-877 * @author Oliver Gierke */ public class ConfigClassInDefaultPackageUnitTests { - /** - * @see DATAMONGO-877 - */ - @Test + @Test // DATAMONGO-877 public void loadsConfigClassFromDefaultPackage() { new AnnotationConfigApplicationContext(ConfigClassInDefaultPackage.class).close(); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AbstractMongoConfigurationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AbstractMongoConfigurationUnitTests.java index 2bb1bd0a0..bc9a3e216 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AbstractMongoConfigurationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AbstractMongoConfigurationUnitTests.java @@ -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. @@ -55,10 +55,7 @@ public class AbstractMongoConfigurationUnitTests { @Rule public ExpectedException exception = ExpectedException.none(); - /** - * @see DATAMONGO-496 - */ - @Test + @Test // DATAMONGO-496 public void usesConfigClassPackageAsBaseMappingPackage() throws ClassNotFoundException { AbstractMongoConfiguration configuration = new SampleMongoConfiguration(); @@ -67,30 +64,21 @@ public class AbstractMongoConfigurationUnitTests { assertThat(configuration.getInitialEntitySet(), hasItem(Entity.class)); } - /** - * @see DATAMONGO-496 - */ - @Test + @Test // DATAMONGO-496 public void doesNotScanPackageIfMappingPackageIsNull() throws ClassNotFoundException { assertScanningDisabled(null); } - /** - * @see DATAMONGO-496 - */ - @Test + @Test // DATAMONGO-496 public void doesNotScanPackageIfMappingPackageIsEmpty() throws ClassNotFoundException { assertScanningDisabled(""); assertScanningDisabled(" "); } - /** - * @see DATAMONGO-569 - */ - @Test + @Test // DATAMONGO-569 public void containsMongoDbFactoryButNoMongoBean() { AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class); @@ -113,10 +101,7 @@ public class AbstractMongoConfigurationUnitTests { assertThat(context.getPersistentEntities(), is(not(emptyIterable()))); } - /** - * @see DATAMONGO-717 - */ - @Test + @Test // DATAMONGO-717 public void lifecycleCallbacksAreInvokedInAppropriateOrder() { AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class); @@ -128,10 +113,7 @@ public class AbstractMongoConfigurationUnitTests { context.close(); } - /** - * @see DATAMONGO-725 - */ - @Test + @Test // DATAMONGO-725 public void shouldBeAbleToConfigureCustomTypeMapperViaJavaConfig() { AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class); @@ -143,18 +125,12 @@ public class AbstractMongoConfigurationUnitTests { context.close(); } - /** - * @see DATAMONGO-789 - */ - @Test + @Test // DATAMONGO-789 public void authenticationDatabaseShouldDefaultToNull() { assertThat(new SampleMongoConfiguration().getAuthenticationDatabaseName(), is(nullValue())); } - /** - * @see DATAMONGO-1470 - */ - @Test + @Test // DATAMONGO-1470 @SuppressWarnings("unchecked") public void allowsMultipleEntityBasePackages() throws ClassNotFoundException { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java index 47cee10e5..fe84ccb3a 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java @@ -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. @@ -35,10 +35,7 @@ import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent; */ public class AuditingIntegrationTests { - /** - * @see DATAMONGO-577, DATAMONGO-800, DATAMONGO-883 - */ - @Test + @Test // DATAMONGO-577, DATAMONGO-800, DATAMONGO-883 public void enablesAuditingAndSetsPropertiesAccordingly() throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext("auditing.xml", getClass()); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingViaJavaConfigRepositoriesTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingViaJavaConfigRepositoriesTests.java index 288e09cb9..7f7bc5eeb 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingViaJavaConfigRepositoriesTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingViaJavaConfigRepositoriesTests.java @@ -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. @@ -79,10 +79,7 @@ public class AuditingViaJavaConfigRepositoriesTests { this.auditor = auditablePersonRepository.save(new AuditablePerson("auditor")); } - /** - * @see DATAMONGO-792, DATAMONGO-883 - */ - @Test + @Test // DATAMONGO-792, DATAMONGO-883 public void basicAuditing() { doReturn(this.auditor).when(this.auditorAware).getCurrentAuditor(); @@ -96,19 +93,13 @@ public class AuditingViaJavaConfigRepositoriesTests { assertThat(savedUser.getCreatedAt(), is(notNullValue())); } - /** - * @see DATAMONGO-843 - */ - @Test + @Test // DATAMONGO-843 @SuppressWarnings("resource") public void auditingUsesFallbackMappingContextIfNoneConfiguredWithRepositories() { new AnnotationConfigApplicationContext(SimpleConfigWithRepositories.class); } - /** - * @see DATAMONGO-843 - */ - @Test + @Test // DATAMONGO-843 @SuppressWarnings("resource") public void auditingUsesFallbackMappingContextIfNoneConfigured() { new AnnotationConfigApplicationContext(SimpleConfig.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/GeoJsonConfigurationIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/GeoJsonConfigurationIntegrationTests.java index 7efa80677..bed30fc8b 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/GeoJsonConfigurationIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/GeoJsonConfigurationIntegrationTests.java @@ -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. @@ -43,10 +43,7 @@ public class GeoJsonConfigurationIntegrationTests { @Autowired GeoJsonModule geoJsonModule; - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 public void picksUpGeoJsonModuleConfigurationByDefault() { assertThat(geoJsonModule, is(notNullValue())); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserIntegrationTests.java index 5082cc3ae..6910aff4f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserIntegrationTests.java @@ -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 MappingMongoConverterParserIntegrationTests { DefaultListableBeanFactory factory; - /** - * @see DATAMONGO-243 - */ - @Test + @Test // DATAMONGO-243 public void allowsDbFactoryRefAttribute() { loadValidConfiguration(); @@ -69,10 +66,7 @@ public class MappingMongoConverterParserIntegrationTests { factory.getBean("converter"); } - /** - * @see DATAMONGO-725 - */ - @Test + @Test // DATAMONGO-725 public void hasCustomTypeMapper() { loadValidConfiguration(); @@ -82,10 +76,7 @@ public class MappingMongoConverterParserIntegrationTests { assertThat(converter.getTypeMapper(), is(customMongoTypeMapper)); } - /** - * @see DATAMONGO-301 - */ - @Test + @Test // DATAMONGO-301 public void scansForConverterAndSetsUpCustomConversionsAccordingly() { loadValidConfiguration(); @@ -94,10 +85,7 @@ public class MappingMongoConverterParserIntegrationTests { assertThat(conversions.hasCustomWriteTarget(Account.class), is(true)); } - /** - * @see DATAMONGO-607 - */ - @Test + @Test // DATAMONGO-607 public void activatesAbbreviatingPropertiesCorrectly() { loadValidConfiguration(); @@ -109,10 +97,7 @@ public class MappingMongoConverterParserIntegrationTests { assertThat(strategy.getBeanClassName(), is(CamelCaseAbbreviatingFieldNamingStrategy.class.getName())); } - /** - * @see DATAMONGO-866 - */ - @Test + @Test // DATAMONGO-866 public void rejectsInvalidFieldNamingStrategyConfiguration() { exception.expect(BeanDefinitionParsingException.class); @@ -124,10 +109,7 @@ public class MappingMongoConverterParserIntegrationTests { reader.loadBeanDefinitions(new ClassPathResource("namespace/converter-invalid.xml")); } - /** - * @see DATAMONGO-892 - */ - @Test + @Test // DATAMONGO-892 public void shouldThrowBeanDefinitionParsingExceptionIfConverterDefinedAsNestedBean() { exception.expect(BeanDefinitionParsingException.class); @@ -136,18 +118,12 @@ public class MappingMongoConverterParserIntegrationTests { loadNestedBeanConfiguration(); } - /** - * @see DATAMONGO-925, DATAMONGO-928 - */ - @Test + @Test // DATAMONGO-925, DATAMONGO-928 public void shouldSupportCustomFieldNamingStrategy() { assertStrategyReferenceSetFor("mappingConverterWithCustomFieldNamingStrategy"); } - /** - * @see DATAMONGO-925, DATAMONGO-928 - */ - @Test + @Test // DATAMONGO-925, DATAMONGO-928 public void shouldNotFailLoadingConfigIfAbbreviationIsDisabledAndStrategySet() { assertStrategyReferenceSetFor("mappingConverterWithCustomFieldNamingStrategyAndAbbreviationDisabled"); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserValidationIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserValidationIntegrationTests.java index d9f34df89..dda529991 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserValidationIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MappingMongoConverterParserValidationIntegrationTests.java @@ -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. @@ -31,7 +31,6 @@ import org.springframework.core.io.ClassPathResource; * {@link org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener} by defining * {@code } in context XML. * - * @see DATAMONGO-36 * @author Maciej Walkowiak * @author Thomas Darimont * @author Oliver Gierke @@ -47,40 +46,28 @@ public class MappingMongoConverterParserValidationIntegrationTests { reader = new XmlBeanDefinitionReader(factory); } - /** - * @see DATAMONGO-36 - */ - @Test + @Test // DATAMONGO-36 public void validatingEventListenerCreatedWithDefaultConfig() { reader.loadBeanDefinitions(new ClassPathResource("namespace/converter-default.xml")); assertThat(factory.getBean(BeanNames.VALIDATING_EVENT_LISTENER_BEAN_NAME), is(not(nullValue()))); } - /** - * @see DATAMONGO-36 - */ - @Test + @Test // DATAMONGO-36 public void validatingEventListenerCreatedWhenValidationEnabled() { reader.loadBeanDefinitions(new ClassPathResource("namespace/converter-validation-enabled.xml")); assertThat(factory.getBean(BeanNames.VALIDATING_EVENT_LISTENER_BEAN_NAME), is(not(nullValue()))); } - /** - * @see DATAMONGO-36 - */ - @Test(expected = NoSuchBeanDefinitionException.class) + @Test(expected = NoSuchBeanDefinitionException.class) // DATAMONGO-36 public void validatingEventListenersIsNotCreatedWhenDisabled() { reader.loadBeanDefinitions(new ClassPathResource("namespace/converter-validation-disabled.xml")); factory.getBean(BeanNames.VALIDATING_EVENT_LISTENER_BEAN_NAME); } - /** - * @see DATAMONGO-36 - */ - @Test + @Test // DATAMONGO-36 public void validatingEventListenerCreatedWithCustomTypeMapperConfig() { reader.loadBeanDefinitions(new ClassPathResource("namespace/converter-custom-typeMapper.xml")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoAuditingRegistrarUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoAuditingRegistrarUnitTests.java index ad076c90d..c918433ef 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoAuditingRegistrarUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoAuditingRegistrarUnitTests.java @@ -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. @@ -25,7 +25,6 @@ import org.springframework.core.type.AnnotationMetadata; /** * Unit tests for {@link JpaAuditingRegistrar}. * - * @see DATAMONGO-792 * @author Oliver Gierke */ @RunWith(MockitoJUnitRunner.class) @@ -36,12 +35,12 @@ public class MongoAuditingRegistrarUnitTests { @Mock AnnotationMetadata metadata; @Mock BeanDefinitionRegistry registry; - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-792 public void rejectsNullAnnotationMetadata() { registrar.registerBeanDefinitions(null, registry); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-792 public void rejectsNullBeanDefinitionRegistry() { registrar.registerBeanDefinitions(metadata, null); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoClientParserIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoClientParserIntegrationTests.java index a2abd7c6e..b3f9c0541 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoClientParserIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoClientParserIntegrationTests.java @@ -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. @@ -51,10 +51,7 @@ public class MongoClientParserIntegrationTests { this.reader = new XmlBeanDefinitionReader(factory); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void createsMongoClientCorrectlyWhenGivenHostAndPort() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongoClient-bean.xml")); @@ -62,10 +59,7 @@ public class MongoClientParserIntegrationTests { assertThat(factory.getBean("mongo-client-with-host-and-port"), instanceOf(MongoClient.class)); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void createsMongoClientWithOptionsCorrectly() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongoClient-bean.xml")); @@ -84,10 +78,7 @@ public class MongoClientParserIntegrationTests { } } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void createsMongoClientWithDefaultsCorrectly() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongoClient-bean.xml")); @@ -105,10 +96,7 @@ public class MongoClientParserIntegrationTests { } } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void createsMongoClientWithCredentialsCorrectly() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongoClient-bean.xml")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoCredentialPropertyEditorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoCredentialPropertyEditorUnitTests.java index ba9257cbe..bcebbce44 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoCredentialPropertyEditorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoCredentialPropertyEditorUnitTests.java @@ -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. @@ -75,10 +75,7 @@ public class MongoCredentialPropertyEditorUnitTests { this.editor = new MongoCredentialPropertyEditor(); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void shouldReturnNullValueForNullText() { editor.setAsText(null); @@ -86,10 +83,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat(editor.getValue(), nullValue()); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void shouldReturnNullValueForEmptyText() { editor.setAsText(" "); @@ -97,26 +91,17 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat(editor.getValue(), nullValue()); } - /** - * @see DATAMONGO-1158 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1158 public void shouldThrowExceptionForMalformatedCredentialsString() { editor.setAsText("tyrion"); } - /** - * @see DATAMONGO-1158 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1158 public void shouldThrowExceptionForMalformatedAuthMechanism() { editor.setAsText(USER_2_AUTH_STRING + "?uri.authMechanism=Targaryen"); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenSingleUserNamePasswordStringWithDatabaseAndNoOptions() { @@ -125,10 +110,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_1_CREDENTIALS)); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenSingleUserNamePasswordStringWithDatabaseAndAuthOptions() { @@ -137,10 +119,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_1_CREDENTIALS_PLAIN_AUTH)); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenMultipleUserNamePasswordStringWithDatabaseAndNoOptions() { @@ -150,10 +129,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_1_CREDENTIALS, USER_2_CREDENTIALS)); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenMultipleUserNamePasswordStringWithDatabaseAndAuthOptions() { @@ -164,10 +140,7 @@ public class MongoCredentialPropertyEditorUnitTests { contains(USER_1_CREDENTIALS_PLAIN_AUTH, USER_2_CREDENTIALS_CR_AUTH)); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenMultipleUserNamePasswordStringWithDatabaseAndMixedOptions() { @@ -177,10 +150,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_1_CREDENTIALS_PLAIN_AUTH, USER_2_CREDENTIALS)); } - /** - * @see DATAMONGO-1257 - */ - @Test + @Test // DATAMONGO-1257 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenMultipleQuotedUserNamePasswordStringWithDatabaseAndNoOptions() { @@ -190,10 +160,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_1_CREDENTIALS, USER_2_CREDENTIALS)); } - /** - * @see DATAMONGO-1257 - */ - @Test + @Test // DATAMONGO-1257 @SuppressWarnings("unchecked") public void shouldReturnCredentialsValueCorrectlyWhenGivenSingleQuotedUserNamePasswordStringWithDatabaseAndNoOptions() { @@ -202,10 +169,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_1_CREDENTIALS)); } - /** - * @see DATAMONGO-1257 - */ - @Test + @Test // DATAMONGO-1257 @SuppressWarnings("unchecked") public void shouldReturnX509CredentialsCorrectly() { @@ -214,10 +178,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(USER_3_CREDENTIALS_X509_AUTH)); } - /** - * @see DATAMONGO-1257 - */ - @Test + @Test // DATAMONGO-1257 @SuppressWarnings("unchecked") public void shouldReturnX509CredentialsCorrectlyWhenNoDbSpecified() { @@ -226,10 +187,7 @@ public class MongoCredentialPropertyEditorUnitTests { assertThat((List) editor.getValue(), contains(MongoCredential.createMongoX509Credential("tyrion"))); } - /** - * @see DATAMONGO-1257 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1257 public void shouldThrowExceptionWhenNoDbSpecifiedForMongodbCR() { editor.setAsText("tyrion?uri.authMechanism=MONGODB-CR"); @@ -237,10 +195,7 @@ public class MongoCredentialPropertyEditorUnitTests { editor.getValue(); } - /** - * @see DATAMONGO-1257 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1257 public void shouldThrowExceptionWhenDbIsEmptyForMongodbCR() { editor.setAsText("tyrion@?uri.authMechanism=MONGODB-CR"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryNoDatabaseRunningTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryNoDatabaseRunningTests.java index 6e0972c5d..c364fdc5f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryNoDatabaseRunningTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryNoDatabaseRunningTests.java @@ -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. @@ -39,10 +39,7 @@ public class MongoDbFactoryNoDatabaseRunningTests { @Autowired MongoTemplate mongoTemplate; - /** - * @see DATAMONGO-139 - */ - @Test + @Test // DATAMONGO-139 public void startsUpWithoutADatabaseRunning() { assertThat(mongoTemplate.getClass().getName(), is("org.springframework.data.mongodb.core.MongoTemplate")); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryParserIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryParserIntegrationTests.java index a98a2c06d..3f013ac20 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryParserIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoDbFactoryParserIntegrationTests.java @@ -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. @@ -91,10 +91,7 @@ public class MongoDbFactoryParserIntegrationTests { assertWriteConcern(ctx, new WriteConcern("rack1")); } - /** - * @see DATAMONGO-331 - */ - @Test + @Test // DATAMONGO-331 public void readsReplicasWriteConcernCorrectly() { AbstractApplicationContext ctx = new ClassPathXmlApplicationContext( @@ -122,10 +119,7 @@ public class MongoDbFactoryParserIntegrationTests { factory.getBean("first"); } - /** - * @see DATAMONGO-280 - */ - @Test + @Test // DATAMONGO-280 @SuppressWarnings("deprecation") public void parsesMaxAutoConnectRetryTimeCorrectly() { @@ -134,10 +128,7 @@ public class MongoDbFactoryParserIntegrationTests { assertThat(ReflectiveMongoOptionsInvokerTestUtil.getMaxAutoConnectRetryTime(mongo.getMongoOptions()), is(27L)); } - /** - * @see DATAMONGO-295 - */ - @Test + @Test // DATAMONGO-295 public void setsUpMongoDbFactoryUsingAMongoUri() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-uri.xml")); @@ -149,10 +140,7 @@ public class MongoDbFactoryParserIntegrationTests { assertThat(argument, is(notNullValue())); } - /** - * @see DATAMONGO-306 - */ - @Test + @Test // DATAMONGO-306 public void setsUpMongoDbFactoryUsingAMongoUriWithoutCredentials() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-uri-no-credentials.xml")); @@ -168,18 +156,12 @@ public class MongoDbFactoryParserIntegrationTests { assertThat(db.getName(), is("database")); } - /** - * @see DATAMONGO-295 - */ - @Test(expected = BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) // DATAMONGO-295 public void rejectsUriPlusDetailedConfiguration() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-uri-and-details.xml")); } - /** - * @see DATAMONGO-1218 - */ - @Test + @Test // DATAMONGO-1218 public void setsUpMongoDbFactoryUsingAMongoClientUri() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri.xml")); @@ -191,18 +173,12 @@ public class MongoDbFactoryParserIntegrationTests { assertThat(argument, is(notNullValue())); } - /** - * @see DATAMONGO-1218 - */ - @Test(expected = BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) // DATAMONGO-1218 public void rejectsClientUriPlusDetailedConfiguration() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-and-details.xml")); } - /** - * @see DATAMONGO-1293 - */ - @Test + @Test // DATAMONGO-1293 public void setsUpClientUriWithId() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-and-id.xml")); @@ -214,10 +190,7 @@ public class MongoDbFactoryParserIntegrationTests { assertThat(argument, is(notNullValue())); } - /** - * @see DATAMONGO-1293 - */ - @Test + @Test // DATAMONGO-1293 public void setsUpUriWithId() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-uri-and-id.xml")); @@ -229,18 +202,12 @@ public class MongoDbFactoryParserIntegrationTests { assertThat(argument, is(notNullValue())); } - /** - * @see DATAMONGO-1293 - */ - @Test(expected = BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) // DATAMONGO-1293 public void rejectsClientUriPlusDetailedConfigurationAndWriteConcern() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-write-concern-and-details.xml")); } - /** - * @see DATAMONGO-1293 - */ - @Test(expected = BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) // DATAMONGO-1293 public void rejectsUriPlusDetailedConfigurationAndWriteConcern() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-write-concern-and-details.xml")); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceTests.java index 2debb0afc..1b6463046 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-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. @@ -90,10 +90,7 @@ public class MongoNamespaceTests { options.getSocketFactory() instanceof SSLSocketFactory); } - /** - * @see DATAMONGO-764 - */ - @Test + @Test // DATAMONGO-764 public void testMongoSingletonWithSslEnabled() throws Exception { assertTrue(ctx.containsBean("mongoSsl")); @@ -103,10 +100,7 @@ public class MongoNamespaceTests { assertTrue("socketFactory should be a SSLSocketFactory", options.getSocketFactory() instanceof SSLSocketFactory); } - /** - * @see DATAMONGO-1490 - */ - @Test + @Test // DATAMONGO-1490 public void testMongoClientSingletonWithSslEnabled() { assertTrue(ctx.containsBean("mongoClientSsl")); @@ -116,10 +110,7 @@ public class MongoNamespaceTests { assertTrue("socketFactory should be a SSLSocketFactory", options.getSocketFactory() instanceof SSLSocketFactory); } - /** - * @see DATAMONGO-764 - */ - @Test + @Test // DATAMONGO-764 public void testMongoSingletonWithSslEnabledAndCustomSslSocketFactory() throws Exception { assertTrue(ctx.containsBean("mongoSslWithCustomSslFactory")); @@ -145,10 +136,7 @@ public class MongoNamespaceTests { assertEquals("database", getField(dbf, "databaseName")); } - /** - * @see DATAMONGO-789 - */ - @Test + @Test // DATAMONGO-789 public void testThirdMongoDbFactory() { assertTrue(ctx.containsBean("thirdMongoDbFactory")); @@ -163,10 +151,7 @@ public class MongoNamespaceTests { assertEquals("admin", getField(dbf, "authenticationDatabaseName")); } - /** - * @see DATAMONGO-140 - */ - @Test + @Test // DATAMONGO-140 public void testMongoTemplateFactory() { assertTrue(ctx.containsBean("mongoTemplate")); @@ -179,10 +164,7 @@ public class MongoNamespaceTests { assertNotNull(converter); } - /** - * @see DATAMONGO-140 - */ - @Test + @Test // DATAMONGO-140 public void testSecondMongoTemplateFactory() { assertTrue(ctx.containsBean("anotherMongoTemplate")); @@ -195,10 +177,7 @@ public class MongoNamespaceTests { assertEquals(WriteConcern.SAFE, writeConcern); } - /** - * @see DATAMONGO-628 - */ - @Test + @Test // DATAMONGO-628 public void testGridFsTemplateFactory() { assertTrue(ctx.containsBean("gridFsTemplate")); @@ -211,10 +190,7 @@ public class MongoNamespaceTests { assertNotNull(converter); } - /** - * @see DATAMONGO-628 - */ - @Test + @Test // DATAMONGO-628 public void testSecondGridFsTemplateFactory() { assertTrue(ctx.containsBean("secondGridFsTemplate")); @@ -228,10 +204,7 @@ public class MongoNamespaceTests { assertNotNull(converter); } - /** - * @see DATAMONGO-823 - */ - @Test + @Test // DATAMONGO-823 public void testThirdGridFsTemplateFactory() { assertTrue(ctx.containsBean("thirdGridFsTemplate")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoParserIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoParserIntegrationTests.java index 0ca28717e..b8d1b525d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoParserIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoParserIntegrationTests.java @@ -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. @@ -62,10 +62,7 @@ public class MongoParserIntegrationTests { factory.getBean("mongo"); } - /** - * @see DATAMONGO-343 - */ - @Test + @Test // DATAMONGO-343 public void readsServerAddressesCorrectly() { reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-bean.xml")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ReadPreferencePropertyEditorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ReadPreferencePropertyEditorUnitTests.java index 6f8f0c954..a334dbab8 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ReadPreferencePropertyEditorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ReadPreferencePropertyEditorUnitTests.java @@ -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. @@ -41,10 +41,7 @@ public class ReadPreferencePropertyEditorUnitTests { editor = new ReadPreferencePropertyEditor(); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void shouldThrowExceptionOnUndefinedPreferenceString() { expectedException.expect(IllegalArgumentException.class); @@ -54,10 +51,7 @@ public class ReadPreferencePropertyEditorUnitTests { editor.setAsText("foo"); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void shouldAllowUsageNativePreferenceStrings() { editor.setAsText("secondary"); @@ -65,10 +59,7 @@ public class ReadPreferencePropertyEditorUnitTests { assertThat(editor.getValue(), is((Object) ReadPreference.secondary())); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void shouldAllowUsageOfUppcaseEnumStringsForPreferences() { editor.setAsText("NEAREST"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ServerAddressPropertyEditorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ServerAddressPropertyEditorUnitTests.java index 19565433c..34fa52a86 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ServerAddressPropertyEditorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/ServerAddressPropertyEditorUnitTests.java @@ -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. @@ -48,11 +48,7 @@ public class ServerAddressPropertyEditorUnitTests { editor = new ServerAddressPropertyEditor(); } - /** - * @see DATAMONGO-454 - * @see DATAMONGO-1062 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-454, DATAMONGO-1062 public void rejectsAddressConfigWithoutASingleParsableAndResolvableServerAddress() { String unknownHost1 = "gugu.nonexistant.example.org"; @@ -63,40 +59,28 @@ public class ServerAddressPropertyEditorUnitTests { editor.setAsText(unknownHost1 + "," + unknownHost2); } - /** - * @see DATAMONGO-454 - */ - @Test + @Test // DATAMONGO-454 public void skipsUnparsableAddressIfAtLeastOneIsParsable() throws UnknownHostException { editor.setAsText("foo, localhost"); assertSingleAddressOfLocalhost(editor.getValue()); } - /** - * @see DATAMONGO-454 - */ - @Test + @Test // DATAMONGO-454 public void handlesEmptyAddressAsParseError() throws UnknownHostException { editor.setAsText(", localhost"); assertSingleAddressOfLocalhost(editor.getValue()); } - /** - * @see DATAMONGO-693 - */ - @Test + @Test // DATAMONGO-693 public void interpretEmptyStringAsNull() { editor.setAsText(""); assertNull(editor.getValue()); } - /** - * @see DATAMONGO-808 - */ - @Test + @Test // DATAMONGO-808 public void handleIPv6HostaddressLoopbackShort() throws UnknownHostException { String hostAddress = "::1"; @@ -105,10 +89,7 @@ public class ServerAddressPropertyEditorUnitTests { assertSingleAddressWithPort(hostAddress, null, editor.getValue()); } - /** - * @see DATAMONGO-808 - */ - @Test + @Test // DATAMONGO-808 public void handleIPv6HostaddressLoopbackShortWithPort() throws UnknownHostException { String hostAddress = "::1"; @@ -120,10 +101,8 @@ public class ServerAddressPropertyEditorUnitTests { /** * Here we detect no port since the last segment of the address contains leading zeros. - * - * @see DATAMONGO-808 */ - @Test + @Test // DATAMONGO-808 public void handleIPv6HostaddressLoopbackLong() throws UnknownHostException { String hostAddress = "0000:0000:0000:0000:0000:0000:0000:0001"; @@ -132,10 +111,7 @@ public class ServerAddressPropertyEditorUnitTests { assertSingleAddressWithPort(hostAddress, null, editor.getValue()); } - /** - * @see DATAMONGO-808 - */ - @Test + @Test // DATAMONGO-808 public void handleIPv6HostaddressLoopbackLongWithBrackets() throws UnknownHostException { String hostAddress = "[0000:0000:0000:0000:0000:0000:0000:0001]"; @@ -146,10 +122,8 @@ public class ServerAddressPropertyEditorUnitTests { /** * We can't tell whether the last part of the hostAddress represents a port or not. - * - * @see DATAMONGO-808 */ - @Test + @Test // DATAMONGO-808 public void shouldFailToHandleAmbiguousIPv6HostaddressLongWithoutPortAndWithoutBrackets() throws UnknownHostException { expectedException.expect(IllegalArgumentException.class); @@ -158,10 +132,7 @@ public class ServerAddressPropertyEditorUnitTests { editor.setAsText(hostAddress); } - /** - * @see DATAMONGO-808 - */ - @Test + @Test // DATAMONGO-808 public void handleIPv6HostaddressExampleAddressWithPort() throws UnknownHostException { String hostAddress = "0000:0000:0000:0000:0000:0000:0000:0001"; @@ -171,10 +142,7 @@ public class ServerAddressPropertyEditorUnitTests { assertSingleAddressWithPort(hostAddress, port, editor.getValue()); } - /** - * @see DATAMONGO-808 - */ - @Test + @Test // DATAMONGO-808 public void handleIPv6HostaddressExampleAddressInBracketsWithPort() throws UnknownHostException { String hostAddress = "[0000:0000:0000:0000:0000:0000:0000:0001]"; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/CloseableIterableCursorAdapterUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/CloseableIterableCursorAdapterUnitTests.java index 1ac451b61..daca6484f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/CloseableIterableCursorAdapterUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/CloseableIterableCursorAdapterUnitTests.java @@ -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. @@ -33,7 +33,6 @@ import com.mongodb.Cursor; * Unit tests for {@link CloseableIterableCursorAdapter}. * * @author Oliver Gierke - * @see DATAMONGO-1276 */ @RunWith(MockitoJUnitRunner.class) public class CloseableIterableCursorAdapterUnitTests { @@ -51,30 +50,21 @@ public class CloseableIterableCursorAdapterUnitTests { this.adapter = new CloseableIterableCursorAdapter(cursor, exceptionTranslator, callback); } - /** - * @see DATAMONGO-1276 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1276 public void propagatesOriginalExceptionFromAdapterDotNext() { cursor.next(); adapter.next(); } - /** - * @see DATAMONGO-1276 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1276 public void propagatesOriginalExceptionFromAdapterDotHasNext() { cursor.hasNext(); adapter.hasNext(); } - /** - * @see DATAMONGO-1276 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1276 public void propagatesOriginalExceptionFromAdapterDotClose() { cursor.close(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultBulkOperationsIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultBulkOperationsIntegrationTests.java index 26c09f53f..e4b9d9e16 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultBulkOperationsIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultBulkOperationsIntegrationTests.java @@ -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. @@ -65,34 +65,22 @@ public class DefaultBulkOperationsIntegrationTests { this.collection.remove(new BasicDBObject()); } - /** - * @see DATAMONGO-934 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-934 public void rejectsNullMongoOperations() { new DefaultBulkOperations(null, null, COLLECTION_NAME, null); } - /** - * @see DATAMONGO-934 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-934 public void rejectsNullCollectionName() { new DefaultBulkOperations(operations, null, null, null); } - /** - * @see DATAMONGO-934 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-934 public void rejectsEmptyCollectionName() { new DefaultBulkOperations(operations, null, "", null); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void insertOrdered() { List documents = Arrays.asList(newDoc("1"), newDoc("2")); @@ -100,10 +88,7 @@ public class DefaultBulkOperationsIntegrationTests { assertThat(createBulkOps(BulkMode.ORDERED).insert(documents).execute().getInsertedCount(), is(2)); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void insertOrderedFails() { List documents = Arrays.asList(newDoc("1"), newDoc("1"), newDoc("2")); @@ -118,10 +103,7 @@ public class DefaultBulkOperationsIntegrationTests { } } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void insertUnOrdered() { List documents = Arrays.asList(newDoc("1"), newDoc("2")); @@ -129,10 +111,7 @@ public class DefaultBulkOperationsIntegrationTests { assertThat(createBulkOps(BulkMode.UNORDERED).insert(documents).execute().getInsertedCount(), is(2)); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void insertUnOrderedContinuesOnError() { List documents = Arrays.asList(newDoc("1"), newDoc("1"), newDoc("2")); @@ -147,10 +126,7 @@ public class DefaultBulkOperationsIntegrationTests { } } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void upsertDoesUpdate() { insertSomeDocuments(); @@ -167,10 +143,7 @@ public class DefaultBulkOperationsIntegrationTests { assertThat(result.getUpserts().size(), is(0)); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void upsertDoesInsert() { BulkWriteResult result = createBulkOps(BulkMode.ORDERED).// @@ -184,60 +157,40 @@ public class DefaultBulkOperationsIntegrationTests { assertThat(result.getUpserts().size(), is(1)); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void updateOneOrdered() { testUpdate(BulkMode.ORDERED, false, 2); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void updateMultiOrdered() { testUpdate(BulkMode.ORDERED, true, 4); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void updateOneUnOrdered() { testUpdate(BulkMode.UNORDERED, false, 2); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void updateMultiUnOrdered() { testUpdate(BulkMode.UNORDERED, true, 4); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void removeOrdered() { testRemove(BulkMode.ORDERED); } - /** - * @see DATAMONGO-934 - */ - @Test + @Test // DATAMONGO-934 public void removeUnordered() { testRemove(BulkMode.UNORDERED); } /** * If working on the same set of documents, only an ordered bulk operation will yield predictable results. - * - * @see DATAMONGO-934 */ - @Test + @Test // DATAMONGO-934 public void mixedBulkOrdered() { BulkWriteResult result = createBulkOps(BulkMode.ORDERED).insert(newDoc("1", "v1")).// @@ -271,10 +224,7 @@ public class DefaultBulkOperationsIntegrationTests { assertThat(result.getRemovedCount(), is(1)); } - /** - * @see DATAMONGO-1534 - */ - @Test + @Test // DATAMONGO-1534 public void insertShouldConsiderInheritance() { SpecialDoc specialDoc = new SpecialDoc(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultIndexOperationsIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultIndexOperationsIntegrationTests.java index b8ded92d6..04ab43f42 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultIndexOperationsIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultIndexOperationsIntegrationTests.java @@ -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. @@ -81,10 +81,7 @@ public class DefaultIndexOperationsIntegrationTests { } } - /** - * @see DATAMONGO-1008 - */ - @Test + @Test // DATAMONGO-1008 public void getIndexInfoShouldBeAbleToRead2dsphereIndex() { collection.createIndex(GEO_SPHERE_2D); @@ -93,10 +90,7 @@ public class DefaultIndexOperationsIntegrationTests { assertThat(info.getIndexFields().get(0).isGeo(), is(true)); } - /** - * @see DATAMONGO-1467 - */ - @Test + @Test // DATAMONGO-1467 public void shouldApplyPartialFilterCorrectly() { assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true)); @@ -110,10 +104,7 @@ public class DefaultIndexOperationsIntegrationTests { assertThat(info.getPartialFilterExpression(), is(equalTo("{ \"q-t-y\" : { \"$gte\" : 10}}"))); } - /** - * @see DATAMONGO-1467 - */ - @Test + @Test // DATAMONGO-1467 public void shouldApplyPartialFilterWithMappedPropertyCorrectly() { assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true)); @@ -127,10 +118,7 @@ public class DefaultIndexOperationsIntegrationTests { assertThat(info.getPartialFilterExpression(), is(equalTo("{ \"qty\" : { \"$gte\" : 10}}"))); } - /** - * @see DATAMONGO-1467 - */ - @Test + @Test // DATAMONGO-1467 public void shouldApplyPartialDBOFilterCorrectly() { assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true)); @@ -144,10 +132,7 @@ public class DefaultIndexOperationsIntegrationTests { assertThat(info.getPartialFilterExpression(), is(equalTo("{ \"qty\" : { \"$gte\" : 10}}"))); } - /** - * @see DATAMONGO-1467 - */ - @Test + @Test // DATAMONGO-1467 public void shouldFavorExplicitMappingHintViaClass() { assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true)); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsTests.java index 04834ae69..9bbaa7c9e 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsTests.java @@ -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. @@ -82,18 +82,12 @@ public class DefaultScriptOperationsTests { this.scriptOps = new DefaultScriptOperations(template); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void executeShouldDirectlyRunExecutableMongoScript() { assertThat(scriptOps.execute(EXECUTABLE_SCRIPT, 10), is((Object) 10D)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void saveShouldStoreCallableScriptCorrectly() { Query query = query(where("_id").is(SCRIPT_NAME)); @@ -104,10 +98,7 @@ public class DefaultScriptOperationsTests { assumeThat(template.exists(query, JAVASCRIPT_COLLECTION_NAME), is(true)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void saveShouldStoreExecutableScriptCorrectly() { NamedMongoScript script = scriptOps.register(EXECUTABLE_SCRIPT); @@ -116,10 +107,7 @@ public class DefaultScriptOperationsTests { assumeThat(template.exists(query, JAVASCRIPT_COLLECTION_NAME), is(true)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void executeShouldRunCallableScriptThatHasBeenSavedBefore() { scriptOps.register(CALLABLE_SCRIPT); @@ -132,10 +120,7 @@ public class DefaultScriptOperationsTests { assertThat(result, is((Object) 10D)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void existsShouldReturnTrueIfScriptAvailableOnServer() { scriptOps.register(CALLABLE_SCRIPT); @@ -143,18 +128,12 @@ public class DefaultScriptOperationsTests { assertThat(scriptOps.exists(SCRIPT_NAME), is(true)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void existsShouldReturnFalseIfScriptNotAvailableOnServer() { assertThat(scriptOps.exists(SCRIPT_NAME), is(false)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void callShouldExecuteExistingScript() { scriptOps.register(CALLABLE_SCRIPT); @@ -164,18 +143,12 @@ public class DefaultScriptOperationsTests { assertThat(result, is((Object) 10D)); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = UncategorizedDataAccessException.class) + @Test(expected = UncategorizedDataAccessException.class) // DATAMONGO-479 public void callShouldThrowExceptionWhenCallingScriptThatDoesNotExist() { scriptOps.call(SCRIPT_NAME, 10); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void scriptNamesShouldContainNameOfRegisteredScript() { scriptOps.register(CALLABLE_SCRIPT); @@ -183,18 +156,12 @@ public class DefaultScriptOperationsTests { assertThat(scriptOps.getScriptNames(), hasItems("echo")); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void scriptNamesShouldReturnEmptySetWhenNoScriptRegistered() { assertThat(scriptOps.getScriptNames(), is(empty())); } - /** - * @see DATAMONGO-1465 - */ - @Test + @Test // DATAMONGO-1465 public void executeShouldNotQuoteStrings() { assertThat(scriptOps.execute(EXECUTABLE_SCRIPT, "spring-data"), is((Object) "spring-data")); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsUnitTests.java index 833bf1028..3a42d7212 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultScriptOperationsUnitTests.java @@ -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. @@ -47,26 +47,17 @@ public class DefaultScriptOperationsUnitTests { this.scriptOps = new DefaultScriptOperations(mongoOperations); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void rejectsNullExecutableMongoScript() { scriptOps.register((ExecutableMongoScript) null); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void rejectsNullNamedMongoScript() { scriptOps.register((NamedMongoScript) null); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void saveShouldUseCorrectCollectionName() { scriptOps.register(new NamedMongoScript("foo", "function...")); @@ -74,10 +65,7 @@ public class DefaultScriptOperationsUnitTests { verify(mongoOperations, times(1)).save(any(NamedMongoScript.class), eq("system.js")); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void saveShouldGenerateScriptNameForExecutableMongoScripts() { scriptOps.register(new ExecutableMongoScript("function...")); @@ -88,42 +76,27 @@ public class DefaultScriptOperationsUnitTests { Assert.assertThat(captor.getValue().getName(), notNullValue()); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void executeShouldThrowExceptionWhenScriptIsNull() { scriptOps.execute(null); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void existsShouldThrowExceptionWhenScriptNameIsNull() { scriptOps.exists(null); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void existsShouldThrowExceptionWhenScriptNameIsEmpty() { scriptOps.exists(""); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void callShouldThrowExceptionWhenScriptNameIsNull() { scriptOps.call(null); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void callShouldThrowExceptionWhenScriptNameIsEmpty() { scriptOps.call(""); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/GeoCommandStatisticsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/GeoCommandStatisticsUnitTests.java index 7fd4a093e..ec4d05e09 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/GeoCommandStatisticsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/GeoCommandStatisticsUnitTests.java @@ -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. @@ -30,18 +30,12 @@ import com.mongodb.BasicDBObject; */ public class GeoCommandStatisticsUnitTests { - /** - * @see DATAMONGO-1361 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1361 public void rejectsNullCommandResult() { GeoCommandStatistics.from(null); } - /** - * @see DATAMONGO-1361 - */ - @Test + @Test // DATAMONGO-1361 public void fallsBackToNanIfNoAverageDistanceIsAvailable() { GeoCommandStatistics statistics = GeoCommandStatistics.from(new BasicDBObject("stats", null)); @@ -51,10 +45,7 @@ public class GeoCommandStatisticsUnitTests { assertThat(statistics.getAverageDistance(), is(Double.NaN)); } - /** - * @see DATAMONGO-1361 - */ - @Test + @Test // DATAMONGO-1361 public void returnsAverageDistanceIfPresent() { GeoCommandStatistics statistics = GeoCommandStatistics diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoClientOptionsFactoryBeanIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoClientOptionsFactoryBeanIntegrationTests.java index 7bd5388d5..ab5842646 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoClientOptionsFactoryBeanIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoClientOptionsFactoryBeanIntegrationTests.java @@ -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. @@ -33,10 +33,7 @@ import com.mongodb.ReadPreference; */ public class MongoClientOptionsFactoryBeanIntegrationTests { - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void convertsReadPreferenceConcernCorrectly() { RootBeanDefinition definition = new RootBeanDefinition(MongoClientOptionsFactoryBean.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsIntegrationTests.java index f2032acc5..f292fd842 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsIntegrationTests.java @@ -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. @@ -89,10 +89,7 @@ public class MongoDbUtilsIntegrationTests { }); } - /** - * @see DATAMONGO-585 - */ - @Test + @Test // DATAMONGO-585 public void authenticatesCorrectlyInMultithreadedEnvironment() throws Exception { // Create sample user @@ -131,10 +128,7 @@ public class MongoDbUtilsIntegrationTests { } } - /** - * @see DATAMONGO-789 - */ - @Test + @Test // DATAMONGO-789 public void authenticatesCorrectlyWithAuthenticationDB() throws Exception { // Create sample user diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsUnitTests.java index b7cf04196..e92d77294 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoDbUtilsUnitTests.java @@ -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. @@ -89,10 +89,7 @@ public class MongoDbUtilsUnitTests { assertThat(MongoDbUtils.getDB(mongo, "first"), is(sameInstance(first))); } - /** - * @see DATAMONGO-737 - */ - @Test + @Test // DATAMONGO-737 public void handlesTransactionSynchronizationLifecycle() { // ensure transaction synchronization manager has no registered @@ -121,10 +118,7 @@ public class MongoDbUtilsUnitTests { assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty(), is(true)); } - /** - * @see DATAMONGO-737 - */ - @Test + @Test // DATAMONGO-737 public void handlesTransactionSynchronizationsLifecycle() { // ensure transaction synchronization manager has no registered @@ -154,10 +148,7 @@ public class MongoDbUtilsUnitTests { assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty(), is(true)); } - /** - * @see DATAMONGO-1218 - */ - @Test + @Test // DATAMONGO-1218 @SuppressWarnings("deprecation") public void getDBDAuthenticateViaAuthDbWhenCalledWithMongoInstance() { @@ -174,10 +165,7 @@ public class MongoDbUtilsUnitTests { verify(mongo, times(1)).getDB("authdb"); } - /** - * @see DATAMONGO-1218 - */ - @Test + @Test // DATAMONGO-1218 @SuppressWarnings("deprecation") public void getDBDShouldSkipAuthenticationViaAuthDbWhenCalledWithMongoClientInstance() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoFactoryBeanIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoFactoryBeanIntegrationTests.java index 1d6045523..f31205b39 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoFactoryBeanIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoFactoryBeanIntegrationTests.java @@ -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. @@ -37,10 +37,7 @@ import com.mongodb.WriteConcern; */ public class MongoFactoryBeanIntegrationTests { - /** - * @see DATAMONGO-408 - */ - @Test + @Test // DATAMONGO-408 public void convertsWriteConcernCorrectly() { RootBeanDefinition definition = new RootBeanDefinition(MongoFactoryBean.class); @@ -54,10 +51,7 @@ public class MongoFactoryBeanIntegrationTests { assertThat(ReflectionTestUtils.getField(bean, "writeConcern"), is((Object) WriteConcern.SAFE)); } - /** - * @see DATAMONGO-693 - */ - @Test + @Test // DATAMONGO-693 public void createMongoInstanceWithHostAndEmptyReplicaSets() { RootBeanDefinition definition = new RootBeanDefinition(MongoFactoryBean.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOperationsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOperationsUnitTests.java index 961433060..9d2d82ab0 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOperationsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOperationsUnitTests.java @@ -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. @@ -302,10 +302,7 @@ public abstract class MongoOperationsUnitTests { }.assertDataAccessException(); } - /** - * @see DATAMONGO-341 - */ - @Test + @Test // DATAMONGO-341 public void geoNearRejectsNullNearQuery() { new Execution() { @@ -316,10 +313,7 @@ public abstract class MongoOperationsUnitTests { }.assertDataAccessException(); } - /** - * @see DATAMONGO-341 - */ - @Test + @Test // DATAMONGO-341 public void geoNearRejectsNullNearQueryifCollectionGiven() { new Execution() { @@ -330,10 +324,7 @@ public abstract class MongoOperationsUnitTests { }.assertDataAccessException(); } - /** - * @see DATAMONGO-341 - */ - @Test + @Test // DATAMONGO-341 public void geoNearRejectsNullEntityClass() { final NearQuery query = NearQuery.near(new Point(10, 20)); @@ -346,10 +337,7 @@ public abstract class MongoOperationsUnitTests { }.assertDataAccessException(); } - /** - * @see DATAMONGO-341 - */ - @Test + @Test // DATAMONGO-341 public void geoNearRejectsNullEntityClassIfCollectionGiven() { final NearQuery query = NearQuery.near(new Point(10, 20)); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOptionsFactoryBeanUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOptionsFactoryBeanUnitTests.java index 19db55a39..c490ec567 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOptionsFactoryBeanUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoOptionsFactoryBeanUnitTests.java @@ -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. @@ -43,11 +43,7 @@ public class MongoOptionsFactoryBeanUnitTests { assumeFalse(isMongo3Driver()); } - /** - * @throws Exception - * @see DATADOC-280 - */ - @Test + @Test // DATADOC-280 public void setsMaxConnectRetryTime() throws Exception { MongoOptionsFactoryBean bean = new MongoOptionsFactoryBean(); @@ -58,11 +54,7 @@ public class MongoOptionsFactoryBeanUnitTests { assertThat(getMaxAutoConnectRetryTime(options), is(27L)); } - /** - * @throws Exception - * @see DATAMONGO-764 - */ - @Test + @Test // DATAMONGO-764 public void testSslConnection() throws Exception { MongoOptionsFactoryBean bean = new MongoOptionsFactoryBean(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java index 385b501ec..c68cc8e41 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java @@ -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. @@ -243,10 +243,7 @@ public class MongoTemplateTests { mongoTemplate.updateFirst(q, u, Person.class); } - /** - * @see DATAMONGO-480 - */ - @Test + @Test // DATAMONGO-480 public void throwsExceptionForDuplicateIds() { MongoTemplate template = new MongoTemplate(factory); @@ -265,11 +262,7 @@ public class MongoTemplateTests { } } - /** - * @see DATAMONGO-480 - * @see DATAMONGO-799 - */ - @Test + @Test // DATAMONGO-480, DATAMONGO-799 public void throwsExceptionForUpdateWithInvalidPushOperator() { MongoTemplate template = new MongoTemplate(factory); @@ -291,10 +284,7 @@ public class MongoTemplateTests { template.updateFirst(query, upd, Person.class); } - /** - * @see DATAMONGO-480 - */ - @Test + @Test // DATAMONGO-480 public void throwsExceptionForIndexViolationIfConfigured() { MongoTemplate template = new MongoTemplate(factory); @@ -317,10 +307,7 @@ public class MongoTemplateTests { } } - /** - * @see DATAMONGO-480 - */ - @Test + @Test // DATAMONGO-480 public void rejectsDuplicateIdInInsertAll() { thrown.expect(DataIntegrityViolationException.class); @@ -394,10 +381,7 @@ public class MongoTemplateTests { assertThat(field, is(IndexField.create("age", Direction.DESC))); } - /** - * @see DATAMONGO-746 - */ - @Test + @Test // DATAMONGO-746 public void testReadIndexInfoForIndicesCreatedViaMongoShellCommands() throws Exception { String command = "db." + template.getCollectionName(Person.class) @@ -578,9 +562,7 @@ public class MongoTemplateTests { assertThat(p9q.getId(), is(p9.getId())); checkCollectionContents(PersonWithIdPropertyOfTypeInteger.class, 1); - /* - * @see DATAMONGO-602 - */ + // DATAMONGO-602 // BigInteger id - provided PersonWithIdPropertyOfTypeBigInteger p9bi = new PersonWithIdPropertyOfTypeBigInteger(); p9bi.setFirstName("Sven_9bi"); @@ -650,10 +632,7 @@ public class MongoTemplateTests { assertThat(template.findAll(entityClass).size(), is(count)); } - /** - * @see DATAMONGO-234 - */ - @Test + @Test // DATAMONGO-234 public void testFindAndUpdate() { template.insert(new Person("Tom", 21)); @@ -821,10 +800,7 @@ public class MongoTemplateTests { assertThat(results3.size(), is(2)); } - /** - * @see DATAMONGO-602 - */ - @Test + @Test // DATAMONGO-602 public void testUsingAnInQueryWithBigIntegerId() throws Exception { template.remove(new Query(), PersonWithIdPropertyOfTypeBigInteger.class); @@ -1141,18 +1117,12 @@ public class MongoTemplateTests { }); } - /** - * @see DATADOC-166 - */ - @Test + @Test // DATADOC-166 public void removingNullIsANoOp() { template.remove(null); } - /** - * @see DATADOC-240, DATADOC-212 - */ - @Test + @Test // DATADOC-240, DATADOC-212 public void updatesObjectIdsCorrectly() { PersonWithIdPropertyOfTypeObjectId person = new PersonWithIdPropertyOfTypeObjectId(); @@ -1211,10 +1181,7 @@ public class MongoTemplateTests { } } - /** - * @see DATADOC-246 - */ - @Test + @Test // DATADOC-246 public void updatesDBRefsCorrectly() { DBRef first = new DBRef("foo", new ObjectId()); @@ -1227,10 +1194,7 @@ public class MongoTemplateTests { List dbrefs; } - /** - * @see DATADOC-202 - */ - @Test + @Test // DATADOC-202 public void executeDocument() { template.insert(new Person("Tom")); template.insert(new Person("Dick")); @@ -1248,10 +1212,7 @@ public class MongoTemplateTests { // template.remove(new Query(), Person.class); } - /** - * @see DATADOC-202 - */ - @Test + @Test // DATADOC-202 public void executeDocumentWithCursorPreparer() { template.insert(new Person("Tom")); template.insert(new Person("Dick")); @@ -1276,10 +1237,7 @@ public class MongoTemplateTests { // template.remove(new Query(), Person.class); } - /** - * @see DATADOC-183 - */ - @Test + @Test // DATADOC-183 public void countsDocumentsCorrectly() { assertThat(template.count(new Query(), Person.class), is(0L)); @@ -1294,26 +1252,17 @@ public class MongoTemplateTests { assertThat(template.count(query(where("firstName").is("Carter")), Person.class), is(1L)); } - /** - * @see DATADOC-183 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATADOC-183 public void countRejectsNullEntityClass() { template.count(null, (Class) null); } - /** - * @see DATADOC-183 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATADOC-183 public void countRejectsEmptyCollectionName() { template.count(null, ""); } - /** - * @see DATADOC-183 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATADOC-183 public void countRejectsNullCollectionName() { template.count(null, (String) null); } @@ -1331,10 +1280,7 @@ public class MongoTemplateTests { assertThat(testClassList.get(0).myDate, is(testClass.myDate)); } - /** - * @see DATADOC-230 - */ - @Test + @Test // DATADOC-230 public void removesEntityFromCollection() { template.remove(new Query(), "mycollection"); @@ -1348,10 +1294,7 @@ public class MongoTemplateTests { assertThat(template.findAll(Person.class, "mycollection").isEmpty(), is(true)); } - /** - * @see DATADOC-349 - */ - @Test + @Test // DATADOC-349 public void removesEntityWithAnnotatedIdIfIdNeedsMassaging() { String id = new ObjectId().toString(); @@ -1367,10 +1310,7 @@ public class MongoTemplateTests { assertThat(template.findOne(query(where("id").is(id)), Sample.class), is(nullValue())); } - /** - * @see DATAMONGO-423 - */ - @Test + @Test // DATAMONGO-423 public void executesQueryWithNegatedRegexCorrectly() { Sample first = new Sample(); @@ -1389,10 +1329,7 @@ public class MongoTemplateTests { assertThat(result.get(0).field, is("Beauford")); } - /** - * @see DATAMONGO-447 - */ - @Test + @Test // DATAMONGO-447 public void storesAndRemovesTypeWithComplexId() { MyId id = new MyId(); @@ -1406,10 +1343,7 @@ public class MongoTemplateTests { template.remove(query(where("id").is(id)), TypeWithMyId.class); } - /** - * @see DATAMONGO-506 - */ - @Test + @Test // DATAMONGO-506 public void exceutesBasicQueryCorrectly() { Address address = new Address(); @@ -1435,10 +1369,7 @@ public class MongoTemplateTests { assertThat(result.get(0), hasProperty("name", is("Oleg"))); } - /** - * @see DATAMONGO-279 - */ - @Test(expected = OptimisticLockingFailureException.class) + @Test(expected = OptimisticLockingFailureException.class) // DATAMONGO-279 public void optimisticLockingHandling() { // Init version @@ -1473,10 +1404,7 @@ public class MongoTemplateTests { template.save(person); } - /** - * @see DATAMONGO-562 - */ - @Test + @Test // DATAMONGO-562 public void optimisticLockingHandlingWithExistingId() { PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger(); @@ -1486,10 +1414,7 @@ public class MongoTemplateTests { template.save(person); } - /** - * @see DATAMONGO-617 - */ - @Test + @Test // DATAMONGO-617 public void doesNotFailOnVersionInitForUnversionedEntity() { DBObject dbObject = new BasicDBObject(); @@ -1498,10 +1423,7 @@ public class MongoTemplateTests { template.insert(dbObject, template.determineCollectionName(PersonWithVersionPropertyOfTypeInteger.class)); } - /** - * @see DATAMONGO-539 - */ - @Test + @Test // DATAMONGO-539 public void removesObjectFromExplicitCollection() { String collectionName = "explicit"; @@ -1516,9 +1438,7 @@ public class MongoTemplateTests { assertThat(template.findAll(PersonWithConvertedId.class, collectionName).isEmpty(), is(true)); } - /** - * @see DATAMONGO-549 - */ + // DATAMONGO-549 public void savesMapCorrectly() { Map map = new HashMap(); @@ -1527,26 +1447,17 @@ public class MongoTemplateTests { template.save(map, "maps"); } - /** - * @see DATAMONGO-549 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-549 public void savesMongoPrimitiveObjectCorrectly() { template.save(new Object(), "collection"); } - /** - * @see DATAMONGO-549 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-549 public void rejectsNullObjectToBeSaved() { template.save(null); } - /** - * @see DATAMONGO-550 - */ - @Test + @Test // DATAMONGO-550 public void savesPlainDbObjectCorrectly() { DBObject dbObject = new BasicDBObject("foo", "bar"); @@ -1555,10 +1466,7 @@ public class MongoTemplateTests { assertThat(dbObject.containsField("_id"), is(true)); } - /** - * @see DATAMONGO-550 - */ - @Test(expected = InvalidDataAccessApiUsageException.class) + @Test(expected = InvalidDataAccessApiUsageException.class) // DATAMONGO-550 public void rejectsPlainObjectWithOutExplicitCollection() { DBObject dbObject = new BasicDBObject("foo", "bar"); @@ -1567,10 +1475,7 @@ public class MongoTemplateTests { template.findById(dbObject.get("_id"), DBObject.class); } - /** - * @see DATAMONGO-550 - */ - @Test + @Test // DATAMONGO-550 public void readsPlainDbObjectById() { DBObject dbObject = new BasicDBObject("foo", "bar"); @@ -1581,26 +1486,17 @@ public class MongoTemplateTests { assertThat(result.get("_id"), is(dbObject.get("_id"))); } - /** - * @see DATAMONGO-551 - */ - @Test + @Test // DATAMONGO-551 public void writesPlainString() { template.save("{ 'foo' : 'bar' }", "collection"); } - /** - * @see DATAMONGO-551 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-551 public void rejectsNonJsonStringForSave() { template.save("Foobar!", "collection"); } - /** - * @see DATAMONGO-588 - */ - @Test + @Test // DATAMONGO-588 public void initializesVersionOnInsert() { PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger(); @@ -1611,10 +1507,7 @@ public class MongoTemplateTests { assertThat(person.version, is(0)); } - /** - * @see DATAMONGO-588 - */ - @Test + @Test // DATAMONGO-588 public void initializesVersionOnBatchInsert() { PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger(); @@ -1625,20 +1518,14 @@ public class MongoTemplateTests { assertThat(person.version, is(0)); } - /** - * @see DATAMONGO-568 - */ - @Test + @Test // DATAMONGO-568 public void queryCantBeNull() { List result = template.findAll(PersonWithIdPropertyOfTypeObjectId.class); assertThat(template.find(null, PersonWithIdPropertyOfTypeObjectId.class), is(result)); } - /** - * @see DATAMONGO-620 - */ - @Test + @Test // DATAMONGO-620 public void versionsObjectIntoDedicatedCollection() { PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger(); @@ -1651,10 +1538,7 @@ public class MongoTemplateTests { assertThat(person.version, is(1)); } - /** - * @see DATAMONGO-621 - */ - @Test + @Test // DATAMONGO-621 public void correctlySetsLongVersionProperty() { PersonWithVersionPropertyOfTypeLong person = new PersonWithVersionPropertyOfTypeLong(); @@ -1664,10 +1548,7 @@ public class MongoTemplateTests { assertThat(person.version, is(0L)); } - /** - * @see DATAMONGO-622 - */ - @Test(expected = DuplicateKeyException.class) + @Test(expected = DuplicateKeyException.class) // DATAMONGO-622 public void preventsDuplicateInsert() { template.setWriteConcern(WriteConcern.SAFE); @@ -1682,10 +1563,7 @@ public class MongoTemplateTests { template.save(person); } - /** - * @see DATAMONGO-629 - */ - @Test + @Test // DATAMONGO-629 public void countAndFindWithoutTypeInformation() { Person person = new Person(); @@ -1698,10 +1576,7 @@ public class MongoTemplateTests { assertThat(template.count(query, collectionName), is(1L)); } - /** - * @see DATAMONGO-571 - */ - @Test + @Test // DATAMONGO-571 public void nullsPropertiesForVersionObjectUpdates() { VersionedPerson person = new VersionedPerson(); @@ -1718,10 +1593,7 @@ public class MongoTemplateTests { assertThat(person.lastname, is(nullValue())); } - /** - * @see DATAMONGO-571 - */ - @Test + @Test // DATAMONGO-571 public void nullsValuesForUpdatesOfUnversionedEntity() { Person person = new Person("Dave"); @@ -1734,10 +1606,7 @@ public class MongoTemplateTests { assertThat(person.getFirstName(), is(nullValue())); } - /** - * @see DATAMONGO-679 - */ - @Test + @Test // DATAMONGO-679 public void savesJsonStringCorrectly() { DBObject dbObject = new BasicDBObject().append("first", "first").append("second", "second"); @@ -1762,10 +1631,7 @@ public class MongoTemplateTests { assertThat(template.exists(query, Sample.class, template.getCollectionName(Sample.class)), is(true)); } - /** - * @see DATAMONGO-675 - */ - @Test + @Test // DATAMONGO-675 public void updateConsidersMappingAnnotations() { TypeWithFieldAnnotation entity = new TypeWithFieldAnnotation(); @@ -1781,10 +1647,7 @@ public class MongoTemplateTests { assertThat(result.emailAddress, is("new")); } - /** - * @see DATAMONGO-671 - */ - @Test + @Test // DATAMONGO-671 public void findsEntityByDateReference() { TypeWithDate entity = new TypeWithDate(); @@ -1798,10 +1661,7 @@ public class MongoTemplateTests { assertThat(result.get(0).date, is(notNullValue())); } - /** - * @see DATAMONGO-540 - */ - @Test + @Test // DATAMONGO-540 public void findOneAfterUpsertForNonExistingObjectReturnsTheInsertedObject() { String idValue = "4711"; @@ -1818,10 +1678,7 @@ public class MongoTemplateTests { assertThat(result.id, is(idValue)); } - /** - * @see DATAMONGO-392 - */ - @Test + @Test // DATAMONGO-392 public void updatesShouldRetainTypeInformation() { Document doc = new Document(); @@ -1842,10 +1699,7 @@ public class MongoTemplateTests { assertThat(result.model.value(), is(newModelValue)); } - /** - * @see DATAMONGO-702 - */ - @Test + @Test // DATAMONGO-702 public void queryShouldSupportRealAndAliasedPropertyNamesForFieldInclusions() { ObjectWith3AliasedFields obj = new ObjectWith3AliasedFields(); @@ -1869,10 +1723,7 @@ public class MongoTemplateTests { assertThat(result.property3, is(obj.property3)); } - /** - * @see DATAMONGO-702 - */ - @Test + @Test // DATAMONGO-702 public void queryShouldSupportRealAndAliasedPropertyNamesForFieldExclusions() { ObjectWith3AliasedFields obj = new ObjectWith3AliasedFields(); @@ -1896,10 +1747,7 @@ public class MongoTemplateTests { assertThat(result.property3, is(nullValue())); } - /** - * @see DATAMONGO-702 - */ - @Test + @Test // DATAMONGO-702 public void findMultipleWithQueryShouldSupportRealAndAliasedPropertyNamesForFieldExclusions() { ObjectWith3AliasedFields obj0 = new ObjectWith3AliasedFields(); @@ -1941,10 +1789,7 @@ public class MongoTemplateTests { assertThat(result1.property3, is(nullValue())); } - /** - * @see DATAMONGO-702 - */ - @Test + @Test // DATAMONGO-702 public void queryShouldSupportNestedPropertyNamesForFieldInclusions() { ObjectWith3AliasedFieldsAndNestedAddress obj = new ObjectWith3AliasedFieldsAndNestedAddress(); @@ -1977,10 +1822,7 @@ public class MongoTemplateTests { assertThat(result.address.state, is(stateValue)); } - /** - * @see DATAMONGO-709 - */ - @Test + @Test // DATAMONGO-709 public void aQueryRestrictedWithOneRestrictedResultTypeShouldReturnOnlyInstancesOfTheRestrictedType() { BaseDoc doc0 = new BaseDoc(); @@ -2006,10 +1848,7 @@ public class MongoTemplateTests { assertThat(result.get(0), is(instanceOf(SpecialDoc.class))); } - /** - * @see DATAMONGO-709 - */ - @Test + @Test // DATAMONGO-709 public void aQueryRestrictedWithMultipleRestrictedResultTypesShouldReturnOnlyInstancesOfTheRestrictedTypes() { BaseDoc doc0 = new BaseDoc(); @@ -2036,10 +1875,7 @@ public class MongoTemplateTests { assertThat(result.get(1).getClass(), is((Object) VerySpecialDoc.class)); } - /** - * @see DATAMONGO-709 - */ - @Test + @Test // DATAMONGO-709 public void aQueryWithNoRestrictedResultTypesShouldReturnAllInstancesWithinTheGivenCollection() { BaseDoc doc0 = new BaseDoc(); @@ -2067,10 +1903,7 @@ public class MongoTemplateTests { assertThat(result.get(2).getClass(), is((Object) VerySpecialDoc.class)); } - /** - * @see DATAMONGO-771 - */ - @Test + @Test // DATAMONGO-771 public void allowInsertWithPlainJsonString() { String id = "4711"; @@ -2085,10 +1918,7 @@ public class MongoTemplateTests { assertThat(result.get(0).field, is(value)); } - /** - * @see DATAMONGO-816 - */ - @Test + @Test // DATAMONGO-816 public void shouldExecuteQueryShouldMapQueryBeforeQueryExecution() { ObjectWithEnumValue o = new ObjectWithEnumValue(); @@ -2112,10 +1942,7 @@ public class MongoTemplateTests { }); } - /** - * @see DATAMONGO-811 - */ - @Test + @Test // DATAMONGO-811 public void updateFirstShouldIncreaseVersionForVersionedEntity() { VersionedPerson person = new VersionedPerson(); @@ -2135,10 +1962,7 @@ public class MongoTemplateTests { assertThat(personAfterUpdateFirst.lastname, is("Bubu")); } - /** - * @see DATAMONGO-811 - */ - @Test + @Test // DATAMONGO-811 public void updateFirstShouldIncreaseVersionOnlyForFirstMatchingEntity() { VersionedPerson person1 = new VersionedPerson(); @@ -2162,10 +1986,7 @@ public class MongoTemplateTests { } } - /** - * @see DATAMONGO-811 - */ - @Test + @Test // DATAMONGO-811 public void updateMultiShouldIncreaseVersionOfAllUpdatedEntities() { VersionedPerson person1 = new VersionedPerson(); @@ -2185,10 +2006,7 @@ public class MongoTemplateTests { } } - /** - * @see DATAMONGO-686 - */ - @Test + @Test // DATAMONGO-686 public void itShouldBePossibleToReuseAnExistingQuery() { Sample sample = new Sample(); @@ -2208,10 +2026,7 @@ public class MongoTemplateTests { assertThat(template.find(query, Sample.class), is(not(empty()))); } - /** - * @see DATAMONGO-807 - */ - @Test + @Test // DATAMONGO-807 public void findAndModifyShouldRetrainTypeInformationWithinUpdatedType() { Document document = new Document(); @@ -2228,10 +2043,7 @@ public class MongoTemplateTests { assertThat(retrieved.model.value(), equalTo("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldRetainTypeInformationWithinUpdatedTypeOnDocumentWithNestedCollectionWhenWholeCollectionIsReplaced() { DocumentWithNestedCollection doc = new DocumentWithNestedCollection(); @@ -2265,10 +2077,7 @@ public class MongoTemplateTests { assertThat(retrieved.models.get(0).get("key2").value(), equalTo("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldRetainTypeInformationWithinUpdatedTypeOnDocumentWithNestedCollectionWhenFirstElementIsReplaced() { DocumentWithNestedCollection doc = new DocumentWithNestedCollection(); @@ -2302,10 +2111,7 @@ public class MongoTemplateTests { assertThat(retrieved.models.get(0).get("key2").value(), equalTo("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldAddTypeInformationOnDocumentWithNestedCollectionObjectInsertedAtSecondIndex() { DocumentWithNestedCollection doc = new DocumentWithNestedCollection(); @@ -2338,10 +2144,7 @@ public class MongoTemplateTests { assertThat(retrieved.models.get(1).get("key2").value(), equalTo("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldRetainTypeInformationWithinUpdatedTypeOnEmbeddedDocumentWithCollectionWhenUpdatingPositionedElement() throws Exception { @@ -2368,10 +2171,7 @@ public class MongoTemplateTests { assertThat(retrieved.embeddedDocument.models.get(0).value(), is("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldAddTypeInformationWithinUpdatedTypeOnEmbeddedDocumentWithCollectionWhenUpdatingSecondElement() throws Exception { @@ -2399,10 +2199,7 @@ public class MongoTemplateTests { assertThat(retrieved.embeddedDocument.models.get(1).value(), is("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldAddTypeInformationWithinUpdatedTypeOnEmbeddedDocumentWithCollectionWhenRewriting() throws Exception { @@ -2429,10 +2226,7 @@ public class MongoTemplateTests { assertThat(retrieved.embeddedDocument.models.get(0).value(), is("value2")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyShouldAddTypeInformationWithinUpdatedTypeOnDocumentWithNestedLists() { DocumentWithNestedList doc = new DocumentWithNestedList(); @@ -2465,10 +2259,7 @@ public class MongoTemplateTests { assertThat(retrieved.models.get(0).get(1).value(), equalTo("value2")); } - /** - * @see DATAMONGO-407 - */ - @Test + @Test // DATAMONGO-407 public void updatesShouldRetainTypeInformationEvenForCollections() { List models = Arrays. asList(new ModelA("foo")); @@ -2493,10 +2284,7 @@ public class MongoTemplateTests { assertThat(result.models.get(0).value(), is(newModelValue)); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void updateMultiShouldAddValuesCorrectlyWhenUsingPushEachWithComplexTypes() { assumeThat(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR), is(true)); @@ -2512,10 +2300,7 @@ public class MongoTemplateTests { assertThat(template.findOne(query, DocumentWithCollection.class).models, hasSize(3)); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void updateMultiShouldAddValuesCorrectlyWhenUsingPushEachWithSimpleTypes() { assumeThat(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR), is(true)); @@ -2533,10 +2318,7 @@ public class MongoTemplateTests { assertThat(template.findOne(query, DocumentWithCollectionOfSimpleType.class).values, hasSize(3)); } - /** - * @see DATAMONOGO-828 - */ - @Test + @Test // DATAMONOGO-828 public void updateFirstShouldDoNothingWhenCalledForEntitiesThatDoNotExist() { Query q = query(where("id").is(Long.MIN_VALUE)); @@ -2545,10 +2327,7 @@ public class MongoTemplateTests { assertThat(template.findOne(q, VersionedPerson.class), nullValue()); } - /** - * @see DATAMONGO-354 - */ - @Test + @Test // DATAMONGO-354 public void testUpdateShouldAllowMultiplePushAll() { DocumentWithMultipleCollections doc = new DocumentWithMultipleCollections(); @@ -2570,10 +2349,7 @@ public class MongoTemplateTests { } - /** - * @see DATAMONGO-404 - */ - @Test + @Test // DATAMONGO-404 public void updateWithPullShouldRemoveNestedItemFromDbRefAnnotatedCollection() { Sample sample1 = new Sample("1", "A"); @@ -2602,10 +2378,7 @@ public class MongoTemplateTests { assertThat(result.dbRefAnnotatedList.get(0).id, is((Object) "1")); } - /** - * @see DATAMONGO-404 - */ - @Test + @Test // DATAMONGO-404 public void updateWithPullShouldRemoveNestedItemFromDbRefAnnotatedCollectionWhenGivenAnIdValueOfComponentTypeEntity() { Sample sample1 = new Sample("1", "A"); @@ -2634,10 +2407,7 @@ public class MongoTemplateTests { assertThat(result.dbRefAnnotatedList.get(0).id, is((Object) "1")); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void updateShouldNotBumpVersionNumberIfVersionPropertyIncludedInUpdate() { VersionedPerson person = new VersionedPerson(); @@ -2657,10 +2427,7 @@ public class MongoTemplateTests { assertThat(personAfterUpdateFirst.lastname, is("Bubu")); } - /** - * @see DATAMONGO-468 - */ - @Test + @Test // DATAMONGO-468 public void shouldBeAbleToUpdateDbRefPropertyWithDomainObject() { Sample sample1 = new Sample("1", "A"); @@ -2686,10 +2453,7 @@ public class MongoTemplateTests { assertThat(updatedDoc.dbRefProperty.field, is(sample2.field)); } - /** - * @see DATAMONGO-862 - */ - @Test + @Test // DATAMONGO-862 public void testUpdateShouldWorkForPathsOnInterfaceMethods() { DocumentWithCollection document = new DocumentWithCollection(Arrays. asList(new ModelA("spring"), @@ -2705,10 +2469,7 @@ public class MongoTemplateTests { assertThat(result.models.get(0).value(), is("mongodb")); } - /** - * @see DATAMONGO-773 - */ - @Test + @Test // DATAMONGO-773 public void testShouldSupportQueryWithIncludedDbRefField() { Sample sample = new Sample("47111", "foo"); @@ -2732,10 +2493,7 @@ public class MongoTemplateTests { assertThat(result.get(0).dbRefProperty.field, is(sample.field)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void testFindAllAndRemoveFullyReturnsAndRemovesDocuments() { Sample spring = new Sample("100", "spring"); @@ -2755,10 +2513,7 @@ public class MongoTemplateTests { assertThat(template.getDb().getCollection("sample").find(new BasicDBObject("field", "data")).count(), is(1)); } - /** - * @see DATAMONGO-1001 - */ - @Test + @Test // DATAMONGO-1001 public void shouldAllowSavingOfLazyLoadedDbRefs() { template.dropCollection(SomeTemplate.class); @@ -2786,10 +2541,7 @@ public class MongoTemplateTests { } - /** - * @see DATAMONGO-880 - */ - @Test + @Test // DATAMONGO-880 public void savingAndReassigningLazyLoadingProxies() { template.dropCollection(SomeTemplate.class); @@ -2822,10 +2574,7 @@ public class MongoTemplateTests { assertThat(savedMessage.normalContent.text, is(content.text)); } - /** - * @see DATAMONGO-884 - */ - @Test + @Test // DATAMONGO-884 public void callingNonObjectMethodsOnLazyLoadingProxyShouldReturnNullIfUnderlyingDbrefWasDeletedInbetween() { template.dropCollection(SomeTemplate.class); @@ -2851,10 +2600,7 @@ public class MongoTemplateTests { assertThat(savedTmpl.getContent().getText(), is(nullValue())); } - /** - * @see DATAMONGO-471 - */ - @Test + @Test // DATAMONGO-471 public void updateMultiShouldAddValuesCorrectlyWhenUsingAddToSetWithEach() { DocumentWithCollectionOfSimpleType document = new DocumentWithCollectionOfSimpleType(); @@ -2870,10 +2616,7 @@ public class MongoTemplateTests { assertThat(template.findOne(query, DocumentWithCollectionOfSimpleType.class).values, hasSize(3)); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void findAndModifyAddToSetWithEachShouldNotAddDuplicatesNorTypeHintForSimpleDocuments() { DocumentWithCollectionOfSamples doc = new DocumentWithCollectionOfSamples(); @@ -2897,10 +2640,7 @@ public class MongoTemplateTests { assertThat(retrieved.samples.get(1).field, is("sample2")); } - /** - * @see DATAMONGO-888 - */ - @Test + @Test // DATAMONGO-888 public void sortOnIdFieldPropertyShouldBeMappedCorrectly() { DoucmentWithNamedIdField one = new DoucmentWithNamedIdField(); @@ -2918,10 +2658,7 @@ public class MongoTemplateTests { assertThat(template.find(query, DoucmentWithNamedIdField.class), contains(two, one)); } - /** - * @see DATAMONGO-888 - */ - @Test + @Test // DATAMONGO-888 public void sortOnAnnotatedFieldPropertyShouldBeMappedCorrectly() { DoucmentWithNamedIdField one = new DoucmentWithNamedIdField(); @@ -2939,10 +2676,7 @@ public class MongoTemplateTests { assertThat(template.find(query, DoucmentWithNamedIdField.class), contains(two, one)); } - /** - * @see DATAMONGO-913 - */ - @Test + @Test // DATAMONGO-913 public void shouldRetrieveInitializedValueFromDbRefAssociationAfterLoad() { SomeContent content = new SomeContent(); @@ -2967,10 +2701,7 @@ public class MongoTemplateTests { assertThat(result.getContent().getText(), is(content.getText())); } - /** - * @see DATAMONGO-913 - */ - @Test + @Test // DATAMONGO-913 public void shouldReuseExistingDBRefInQueryFromDbRefAssociationAfterLoad() { SomeContent content = new SomeContent(); @@ -2995,10 +2726,7 @@ public class MongoTemplateTests { assertThat(result.getContent().getName(), is(content.getName())); } - /** - * @see DATAMONGO-970 - */ - @Test + @Test // DATAMONGO-970 public void insertsAndRemovesBasicDbObjectCorrectly() { BasicDBObject object = new BasicDBObject("key", "value"); @@ -3011,10 +2739,7 @@ public class MongoTemplateTests { assertThat(template.findAll(DBObject.class, "collection"), hasSize(0)); } - /** - * @see DATAMONGO-1207 - */ - @Test + @Test // DATAMONGO-1207 public void ignoresNullElementsForInsertAll() { Address newYork = new Address("NY", "New York"); @@ -3028,10 +2753,7 @@ public class MongoTemplateTests { assertThat(result, hasItems(newYork, washington)); } - /** - * @see DATAMONGO-1208 - */ - @Test + @Test // DATAMONGO-1208 public void takesSortIntoAccountWhenStreaming() { Person youngestPerson = new Person("John", 20); @@ -3047,10 +2769,7 @@ public class MongoTemplateTests { assertThat(stream.next().getAge(), is(oldestPerson.getAge())); } - /** - * @see DATAMONGO-1208 - */ - @Test + @Test // DATAMONGO-1208 public void takesLimitIntoAccountWhenStreaming() { Person youngestPerson = new Person("John", 20); @@ -3066,10 +2785,7 @@ public class MongoTemplateTests { assertThat(stream.hasNext(), is(false)); } - /** - * @see DATAMONGO-1204 - */ - @Test + @Test // DATAMONGO-1204 public void resolvesCyclicDBRefCorrectly() { SomeMessage message = new SomeMessage(); @@ -3091,10 +2807,7 @@ public class MongoTemplateTests { assertThat(contentLoaded.dbrefMessage.id, is(messageLoaded.id)); } - /** - * @see DATAMONGO-1287 - */ - @Test + @Test // DATAMONGO-1287 public void shouldReuseAlreadyResolvedLazyLoadedDBRefWhenUsedAsPersistenceConstrcutorArgument() { Document docInCtor = new Document(); @@ -3112,10 +2825,7 @@ public class MongoTemplateTests { assertThat(loaded.refToDocNotUsedInCtor, nullValue()); } - /** - * @see DATAMONGO-1287 - */ - @Test + @Test // DATAMONGO-1287 public void shouldNotReuseLazyLoadedDBRefWhenTypeUsedInPersistenceConstrcutorButValueRefersToAnotherProperty() { Document docNotUsedInCtor = new Document(); @@ -3134,10 +2844,7 @@ public class MongoTemplateTests { assertThat(loaded.refToDocUsedInCtor, nullValue()); } - /** - * @see DATAMONGO-1287 - */ - @Test + @Test // DATAMONGO-1287 public void shouldRespectParamterValueWhenAttemptingToReuseLazyLoadedDBRefUsedInPersistenceConstrcutor() { Document docInCtor = new Document(); @@ -3160,10 +2867,7 @@ public class MongoTemplateTests { assertThat(loaded.refToDocNotUsedInCtor, instanceOf(LazyLoadingProxy.class)); } - /** - * @see DATAMONGO-1401 - */ - @Test + @Test // DATAMONGO-1401 public void updateShouldWorkForTypesContainingGeoJsonTypes() { WithGeoJson wgj = new WithGeoJson(); @@ -3179,10 +2883,7 @@ public class MongoTemplateTests { assertThat(template.findOne(query(where("id").is(wgj.id)), WithGeoJson.class).point, is(equalTo(wgj.point))); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void updatesDateValueCorrectlyWhenUsingMinOperator() { Calendar cal = Calendar.getInstance(Locale.US); @@ -3197,10 +2898,7 @@ public class MongoTemplateTests { assertThat(loaded.date, equalTo(cal.getTime())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void updatesNumericValueCorrectlyWhenUsingMinOperator() { TypeWithNumbers twn = new TypeWithNumbers(); @@ -3239,10 +2937,7 @@ public class MongoTemplateTests { assertThat(loaded.bigDeciamVal, equalTo(new BigDecimal("690"))); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void updatesDateValueCorrectlyWhenUsingMaxOperator() { Calendar cal = Calendar.getInstance(Locale.US); @@ -3259,10 +2954,7 @@ public class MongoTemplateTests { assertThat(loaded.date, equalTo(cal.getTime())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void updatesNumericValueCorrectlyWhenUsingMaxOperator() { TypeWithNumbers twn = new TypeWithNumbers(); @@ -3301,10 +2993,7 @@ public class MongoTemplateTests { assertThat(loaded.bigDeciamVal, equalTo(new BigDecimal("790"))); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void updatesBigNumberValueUsingStringComparisonWhenUsingMaxOperator() { TypeWithNumbers twn = new TypeWithNumbers(); @@ -3328,10 +3017,7 @@ public class MongoTemplateTests { assertThat(loaded.bigDeciamVal, equalTo(new BigDecimal("80"))); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void updatesBigNumberValueUsingStringComparisonWhenUsingMinOperator() { TypeWithNumbers twn = new TypeWithNumbers(); @@ -3355,10 +3041,7 @@ public class MongoTemplateTests { assertThat(loaded.bigDeciamVal, equalTo(new BigDecimal("800"))); } - /** - * @see DATAMONGO-1431 - */ - @Test + @Test // DATAMONGO-1431 public void streamExecutionUsesExplicitCollectionName() { template.remove(new Query(), "some_special_collection"); @@ -3379,10 +3062,7 @@ public class MongoTemplateTests { assertThat(stream.hasNext(), is(false)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldFetchListOfReferencesCorrectly() { Sample one = new Sample("1", "jon snow"); @@ -3399,10 +3079,7 @@ public class MongoTemplateTests { assertThat(template.findOne(query(where("id").is(source.id)), DocumentWithDBRefCollection.class), is(source)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldFetchListOfLazyReferencesCorrectly() { Sample one = new Sample("1", "jon snow"); @@ -3423,10 +3100,7 @@ public class MongoTemplateTests { assertThat(target.getLazyDbRefAnnotatedList(), contains(two, one)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldFetchMapOfLazyReferencesCorrectly() { Sample one = new Sample("1", "jon snow"); @@ -3448,10 +3122,7 @@ public class MongoTemplateTests { assertThat(target.lazyDbRefAnnotatedMap.values(), contains(two, one)); } - /** - * @see DATAMONGO-1513 - */ - @Test + @Test // DATAMONGO-1513 @DirtiesContext public void populatesIdsAddedByEventListener() { @@ -3534,18 +3205,18 @@ public class MongoTemplateTests { @Id public String id; - @Field("db_ref_list") /** @see DATAMONGO-1058 */ + @Field("db_ref_list") // DATAMONGO-1058 @org.springframework.data.mongodb.core.mapping.DBRef // public List dbRefAnnotatedList; @org.springframework.data.mongodb.core.mapping.DBRef // public Sample dbRefProperty; - @Field("lazy_db_ref_list") /** @see DATAMONGO-1194 */ + @Field("lazy_db_ref_list") // DATAMONGO-1194 @org.springframework.data.mongodb.core.mapping.DBRef(lazy = true) // public List lazyDbRefAnnotatedList; - @Field("lazy_db_ref_map") /** @see DATAMONGO-1194 */ + @Field("lazy_db_ref_map") // DATAMONGO-1194 @org.springframework.data.mongodb.core.mapping.DBRef(lazy = true) public Map lazyDbRefAnnotatedMap; } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java index 40af85d3e..a4bc0595c 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-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. @@ -144,20 +144,14 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { template.mapReduce("foo", "classpath:doesNotExist.js", "function() {}", Person.class); } - /** - * @see DATAMONGO-322 - */ - @Test(expected = InvalidDataAccessApiUsageException.class) + @Test(expected = InvalidDataAccessApiUsageException.class) // DATAMONGO-322 public void rejectsEntityWithNullIdIfNotSupportedIdType() { Object entity = new NotAutogenerateableId(); template.save(entity); } - /** - * @see DATAMONGO-322 - */ - @Test + @Test // DATAMONGO-322 public void storesEntityWithSetIdAlthoughNotAutogenerateable() { NotAutogenerateableId entity = new NotAutogenerateableId(); @@ -166,10 +160,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { template.save(entity); } - /** - * @see DATAMONGO-322 - */ - @Test + @Test // DATAMONGO-322 public void autogeneratesIdForEntityWithAutogeneratableId() { this.converter.afterPropertiesSet(); @@ -184,10 +175,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(entity.id, is(notNullValue())); } - /** - * @see DATAMONGO-374 - */ - @Test + @Test // DATAMONGO-374 public void convertsUpdateConstraintsUsingConverters() { CustomConversions conversions = new CustomConversions(Collections.singletonList(MyConverter.INSTANCE)); @@ -205,10 +193,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { verify(collection, times(1)).update(Mockito.any(DBObject.class), eq(reference), anyBoolean(), anyBoolean()); } - /** - * @see DATAMONGO-474 - */ - @Test + @Test // DATAMONGO-474 public void setsUnpopulatedIdField() { NotAutogenerateableId entity = new NotAutogenerateableId(); @@ -217,10 +202,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(entity.id, is(5)); } - /** - * @see DATAMONGO-474 - */ - @Test + @Test // DATAMONGO-474 public void doesNotSetAlreadyPopulatedId() { NotAutogenerateableId entity = new NotAutogenerateableId(); @@ -230,10 +212,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(entity.id, is(5)); } - /** - * @see DATAMONGO-868 - */ - @Test + @Test // DATAMONGO-868 public void findAndModifyShouldBumpVersionByOneWhenVersionFieldNotIncludedInUpdate() { VersionedEntity v = new VersionedEntity(); @@ -250,10 +229,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { Assert.assertThat(captor.getValue().get("$inc"), Is. is(new BasicDBObject("version", 1L))); } - /** - * @see DATAMONGO-868 - */ - @Test + @Test // DATAMONGO-868 public void findAndModifyShouldNotBumpVersionByOneWhenVersionFieldAlreadyIncludedInUpdate() { VersionedEntity v = new VersionedEntity(); @@ -270,10 +246,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { Assert.assertThat(captor.getValue().get("$inc"), nullValue()); } - /** - * @see DATAMONGO-533 - */ - @Test + @Test // DATAMONGO-533 public void registersDefaultEntityIndexCreatorIfApplicationContextHasOneForDifferentMappingContext() { GenericApplicationContext applicationContext = new GenericApplicationContext(); @@ -300,10 +273,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { })); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void findAllAndRemoveShouldRetrieveMatchingDocumentsPriorToRemoval() { BasicQuery query = new BasicQuery("{'foo':'bar'}"); @@ -311,10 +281,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { verify(collection, times(1)).find(Matchers.eq(query.getQueryObject())); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void findAllAndRemoveShouldRemoveDocumentsReturedByFindQuery() { Mockito.when(cursor.hasNext()).thenReturn(true).thenReturn(true).thenReturn(false); @@ -331,20 +298,14 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat((Object[]) idField.get("$in"), is(new Object[] { Integer.valueOf(0), Integer.valueOf(1) })); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void findAllAndRemoveShouldNotTriggerRemoveIfFindResultIsEmpty() { template.findAllAndRemove(new BasicQuery("{'foo':'bar'}"), VersionedEntity.class); verify(collection, never()).remove(Mockito.any(DBObject.class)); } - /** - * @see DATAMONGO-948 - */ - @Test + @Test // DATAMONGO-948 public void sortShouldBeTakenAsIsWhenExecutingQueryWithoutSpecificTypeInformation() { Query query = Query.query(Criteria.where("foo").is("bar")).with(new Sort("foo")); @@ -361,10 +322,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(captor.getValue(), equalTo(new BasicDBObjectBuilder().add("foo", 1).get())); } - /** - * @see DATAMONGO-1166 - */ - @Test + @Test // DATAMONGO-1166 public void aggregateShouldHonorReadPreferenceWhenSet() { when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn( @@ -377,10 +335,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { verify(this.db, times(1)).command(Mockito.any(DBObject.class), eq(ReadPreference.secondary())); } - /** - * @see DATAMONGO-1166 - */ - @Test + @Test // DATAMONGO-1166 public void aggregateShouldIgnoreReadPreferenceWhenNotSet() { when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn( @@ -392,10 +347,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { verify(this.db, times(1)).command(Mockito.any(DBObject.class)); } - /** - * @see DATAMONGO-1166 - */ - @Test + @Test // DATAMONGO-1166 public void geoNearShouldHonorReadPreferenceWhenSet() { when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn( @@ -409,10 +361,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { verify(this.db, times(1)).command(Mockito.any(DBObject.class), eq(ReadPreference.secondary())); } - /** - * @see DATAMONGO-1166 - */ - @Test + @Test // DATAMONGO-1166 public void geoNearShouldIgnoreReadPreferenceWhenNotSet() { when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn( @@ -425,10 +374,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { verify(this.db, times(1)).command(Mockito.any(DBObject.class)); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void mapReduceShouldUseZeroAsDefaultLimit() { ArgumentCaptor captor = ArgumentCaptor.forClass(MapReduceCommand.class); @@ -446,10 +392,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(captor.getValue().getLimit(), is(0)); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void mapReduceShouldPickUpLimitFromQuery() { ArgumentCaptor captor = ArgumentCaptor.forClass(MapReduceCommand.class); @@ -468,10 +411,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(captor.getValue().getLimit(), is(100)); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void mapReduceShouldPickUpLimitFromOptions() { ArgumentCaptor captor = ArgumentCaptor.forClass(MapReduceCommand.class); @@ -489,10 +429,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(captor.getValue().getLimit(), is(1000)); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void mapReduceShouldPickUpLimitFromOptionsWhenQueryIsNotPresent() { ArgumentCaptor captor = ArgumentCaptor.forClass(MapReduceCommand.class); @@ -508,10 +445,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests { assertThat(captor.getValue().getLimit(), is(1000)); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void mapReduceShouldPickUpLimitFromOptionsEvenWhenQueryDefinesItDifferently() { ArgumentCaptor captor = ArgumentCaptor.forClass(MapReduceCommand.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/NoExplicitIdTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/NoExplicitIdTests.java index de8b22176..c8e72686f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/NoExplicitIdTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/NoExplicitIdTests.java @@ -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. @@ -68,10 +68,7 @@ public class NoExplicitIdTests { mongoOps.dropCollection(TypeWithoutIdProperty.class); } - /** - * @see DATAMONGO-1289 - */ - @Test + @Test // DATAMONGO-1289 public void saveAndRetrieveTypeWithoutIdPorpertyViaTemplate() { TypeWithoutIdProperty noid = new TypeWithoutIdProperty(); @@ -85,10 +82,7 @@ public class NoExplicitIdTests { assertThat(retrieved.someString, is(noid.someString)); } - /** - * @see DATAMONGO-1289 - */ - @Test + @Test // DATAMONGO-1289 public void saveAndRetrieveTypeWithoutIdPorpertyViaRepository() { TypeWithoutIdProperty noid = new TypeWithoutIdProperty(); @@ -100,10 +94,7 @@ public class NoExplicitIdTests { assertThat(retrieved.someString, is(noid.someString)); } - /** - * @see DATAMONGO-1289 - */ - @Test + @Test // DATAMONGO-1289 @SuppressWarnings("unchecked") public void saveAndRetrieveTypeWithoutIdPorpertyViaRepositoryFindOne() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryByExampleTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryByExampleTests.java index faa45f77f..11e2be573 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryByExampleTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryByExampleTests.java @@ -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. @@ -72,10 +72,7 @@ public class QueryByExampleTests { operations.save(p3); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleShouldWorkForSimpleProperty() { Person sample = new Person(); @@ -88,10 +85,7 @@ public class QueryByExampleTests { assertThat(result, hasItems(p1, p3)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleShouldWorkForMultipleProperties() { Person sample = new Person(); @@ -105,10 +99,7 @@ public class QueryByExampleTests { assertThat(result, hasItem(p3)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleShouldWorkForIdProperty() { Person p4 = new Person(); @@ -124,10 +115,7 @@ public class QueryByExampleTests { assertThat(result, hasItem(p4)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleShouldReturnEmptyListIfNotMatching() { Person sample = new Person(); @@ -140,10 +128,7 @@ public class QueryByExampleTests { assertThat(result, is(empty())); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleShouldReturnEverythingWhenSampleIsEmpty() { Person sample = new Person(); @@ -155,10 +140,7 @@ public class QueryByExampleTests { assertThat(result, hasItems(p1, p2, p3)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleWithCriteria() { Person sample = new Person(); @@ -170,10 +152,7 @@ public class QueryByExampleTests { assertThat(result.size(), is(1)); } - /** - * @see DATAMONGO-1459 - */ - @Test + @Test // DATAMONGO-1459 public void findsExampleUsingAnyMatch() { Person probe = new Person(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryCursorPreparerUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryCursorPreparerUnitTests.java index 21ca3f8c0..e534c8fc8 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryCursorPreparerUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/QueryCursorPreparerUnitTests.java @@ -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. @@ -55,10 +55,7 @@ public class QueryCursorPreparerUnitTests { when(cursor.copy()).thenReturn(cursorToUse); } - /** - * @see DATAMONGO-185 - */ - @Test + @Test // DATAMONGO-185 public void appliesHintsCorrectly() { Query query = query(where("foo").is("bar")).withHint("hint"); @@ -68,10 +65,7 @@ public class QueryCursorPreparerUnitTests { verify(cursorToUse).hint("hint"); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void doesNotApplyMetaWhenEmpty() { Query query = query(where("foo").is("bar")); @@ -83,10 +77,7 @@ public class QueryCursorPreparerUnitTests { verify(cursorToUse, never()).addSpecial(any(String.class), anyObject()); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void appliesMaxScanCorrectly() { Query query = query(where("foo").is("bar")).maxScan(100); @@ -96,10 +87,7 @@ public class QueryCursorPreparerUnitTests { verify(cursorToUse).addSpecial(eq("$maxScan"), eq(100L)); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void appliesMaxTimeCorrectly() { Query query = query(where("foo").is("bar")).maxTime(1, TimeUnit.SECONDS); @@ -109,10 +97,7 @@ public class QueryCursorPreparerUnitTests { verify(cursorToUse).addSpecial(eq("$maxTimeMS"), eq(1000L)); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void appliesCommentCorrectly() { Query query = query(where("foo").is("bar")).comment("spring data"); @@ -122,10 +107,7 @@ public class QueryCursorPreparerUnitTests { verify(cursorToUse).addSpecial(eq("$comment"), eq("spring data")); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void appliesSnapshotCorrectly() { Query query = query(where("foo").is("bar")).useSnapshot(); @@ -135,10 +117,7 @@ public class QueryCursorPreparerUnitTests { verify(cursorToUse).addSpecial(eq("$snapshot"), eq(true)); } - /** - * @see DATAMONGO-1480 - */ - @Test + @Test // DATAMONGO-1480 public void appliesNoCursorTimeoutCorrectly() { Query query = query(where("foo").is("bar")).noCursorTimeout(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SerializationUtilsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SerializationUtilsUnitTests.java index 0b42b27c0..8d12f96b6 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SerializationUtilsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SerializationUtilsUnitTests.java @@ -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. @@ -64,10 +64,7 @@ public class SerializationUtilsUnitTests { assertThat(serializeToJsonSafely(dbObject), is(expectedOutput)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void flattenMapShouldFlatOutNestedStructureCorrectly() { DBObject dbo = new BasicDBObjectBuilder().add("_id", 1).add("nested", new BasicDBObject("value", "conflux")).get(); @@ -76,10 +73,7 @@ public class SerializationUtilsUnitTests { assertThat(flattenMap(dbo), hasEntry("nested.value", (Object) "conflux")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void flattenMapShouldFlatOutNestedStructureWithListCorrectly() { BasicDBList dbl = new BasicDBList(); @@ -91,10 +85,7 @@ public class SerializationUtilsUnitTests { assertThat(flattenMap(dbo), hasEntry("nested.value", (Object) dbl)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void flattenMapShouldLeaveKeywordsUntouched() { DBObject dbo = new BasicDBObjectBuilder().add("_id", 1).add("nested", new BasicDBObject("$regex", "^conflux$")) @@ -107,10 +98,7 @@ public class SerializationUtilsUnitTests { assertThat(((Map) map.get("nested")).get("$regex"), is((Object) "^conflux$")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void flattenMapShouldAppendCommandsCorrectly() { DBObject dbo = new BasicDBObjectBuilder().add("_id", 1) @@ -124,10 +112,7 @@ public class SerializationUtilsUnitTests { assertThat(((Map) map.get("nested")).get("$options"), is((Object) "i")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void flattenMapShouldReturnEmptyMapWhenSourceIsNull() { assertThat(flattenMap(null).isEmpty(), is(true)); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SimpleMongoDbFactoryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SimpleMongoDbFactoryUnitTests.java index 9967de75e..ab753b1b2 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SimpleMongoDbFactoryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/SimpleMongoDbFactoryUnitTests.java @@ -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. @@ -49,19 +49,13 @@ public class SimpleMongoDbFactoryUnitTests { public @Rule ExpectedException expectedException = ExpectedException.none(); @Mock Mongo mongo; - /** - * @see DATADOC-254 - */ - @Test + @Test // DATADOC-254 public void rejectsIllegalDatabaseNames() { rejectsDatabaseName("foo.bar"); rejectsDatabaseName("foo!bar"); } - /** - * @see DATADOC-254 - */ - @Test + @Test // DATADOC-254 @SuppressWarnings("deprecation") public void allowsDatabaseNames() { new SimpleMongoDbFactory(mongo, "foo-bar"); @@ -69,11 +63,7 @@ public class SimpleMongoDbFactoryUnitTests { new SimpleMongoDbFactory(mongo, "foo01231bar"); } - /** - * @see DATADOC-295 - * @throws UnknownHostException - */ - @Test + @Test // DATADOC-295 @SuppressWarnings("deprecation") public void mongoUriConstructor() throws UnknownHostException { @@ -84,10 +74,7 @@ public class SimpleMongoDbFactoryUnitTests { assertThat(getField(mongoDbFactory, "databaseName").toString(), is("myDatabase")); } - /** - * @see DATAMONGO-789 - */ - @Test + @Test // DATAMONGO-789 @SuppressWarnings("deprecation") public void defaultsAuthenticationDatabaseToDatabase() { @@ -95,10 +82,7 @@ public class SimpleMongoDbFactoryUnitTests { assertThat(getField(factory, "authenticationDatabaseName"), is((Object) "foo")); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void constructsMongoClientAccordingToMongoUri() throws UnknownHostException { MongoClientURI uri = new MongoClientURI("mongodb://myUserName:myPassWord@127.0.0.1:27017/myDataBase.myCollection"); @@ -107,10 +91,7 @@ public class SimpleMongoDbFactoryUnitTests { assertThat(getField(factory, "databaseName").toString(), is("myDataBase")); } - /** - * @see DATAMONGO-1158 - */ - @Test + @Test // DATAMONGO-1158 public void shouldDefaultAuthenticationDbNameToDbNameWhenUsingMongoClient() throws UnknownHostException { MongoClient clientMock = mock(MongoClient.class); @@ -119,10 +100,7 @@ public class SimpleMongoDbFactoryUnitTests { assertThat(getField(factory, "authenticationDatabaseName").toString(), is("FooBar")); } - /** - * @see DATAMONGO-1260 - */ - @Test + @Test // DATAMONGO-1260 public void rejectsMongoClientWithUserCredentials() { expectedException.expect(InvalidDataAccessApiUsageException.class); @@ -131,10 +109,7 @@ public class SimpleMongoDbFactoryUnitTests { new SimpleMongoDbFactory(mock(MongoClient.class), "cairhienin", new UserCredentials("moiraine", "sedai")); } - /** - * @see DATAMONGO-1260 - */ - @Test + @Test // DATAMONGO-1260 public void rejectsMongoClientWithUserCredentialsAndAuthDb() { expectedException.expect(InvalidDataAccessApiUsageException.class); @@ -143,18 +118,12 @@ public class SimpleMongoDbFactoryUnitTests { new SimpleMongoDbFactory(mock(MongoClient.class), "malkieri", new UserCredentials("lan", "mandragoran"), "authdb"); } - /** - * @see DATAMONGO-1260 - */ - @Test + @Test // DATAMONGO-1260 public void shouldNotRejectMongoClientWithNoCredentials() { new SimpleMongoDbFactory(mock(MongoClient.class), "andoran", UserCredentials.NO_CREDENTIALS); } - /** - * @see DATAMONGO-1260 - */ - @Test + @Test // DATAMONGO-1260 public void shouldNotRejectMongoClientWithEmptyUserCredentials() { new SimpleMongoDbFactory(mock(MongoClient.class), "shangtai", new UserCredentials("", "")); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationOptionsTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationOptionsTests.java index ea3f556d4..45549e114 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationOptionsTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationOptionsTests.java @@ -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. @@ -42,10 +42,7 @@ public class AggregationOptionsTests { } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void aggregationOptionsBuilderShouldSetOptionsAccordingly() { assertThat(aggregationOptions.isAllowDiskUse(), is(true)); @@ -53,10 +50,7 @@ public class AggregationOptionsTests { assertThat(aggregationOptions.getCursor(), is((DBObject) new BasicDBObject("foo", 1))); } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void aggregationOptionsToString() { assertThat(aggregationOptions.toString(), is("{ \"allowDiskUse\" : true , \"explain\" : true , \"cursor\" : { \"foo\" : 1}}")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTests.java index 8adb939df..9330b3e26 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTests.java @@ -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. @@ -81,8 +81,7 @@ import com.mongodb.util.JSON; /** * Tests for {@link MongoTemplate#aggregate(String, AggregationPipeline, Class)}. - * - * @see DATAMONGO-586 + * * @author Tobias Trelle * @author Thomas Darimont * @author Oliver Gierke @@ -150,10 +149,10 @@ public class AggregationTests { } /** - * Imports the sample dataset (zips.json) if necessary (e.g. if it doen't exist yet). The dataset can originally be + * Imports the sample dataset (zips.json) if necessary (e.g. if it doesn't exist yet). The dataset can originally be * found on the mongodb aggregation framework example website: * - * @see http://docs.mongodb.org/manual/tutorial/aggregation-examples/. + * @see MongoDB Aggregation Examples */ private void initSampleDataIfNecessary() { @@ -192,22 +191,22 @@ public class AggregationTests { } } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-586 public void shouldHandleMissingInputCollection() { mongoTemplate.aggregate(newAggregation(), (String) null, TagCount.class); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-586 public void shouldHandleMissingAggregationPipeline() { mongoTemplate.aggregate(null, INPUT_COLLECTION, TagCount.class); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-586 public void shouldHandleMissingEntityClass() { mongoTemplate.aggregate(newAggregation(), INPUT_COLLECTION, null); } - @Test + @Test // DATAMONGO-586 public void shouldAggregate() { createTagDocuments(); @@ -236,7 +235,7 @@ public class AggregationTests { assertTagCount("nosql", 1, tagCount.get(2)); } - @Test + @Test // DATAMONGO-586 public void shouldAggregateEmptyCollection() { Aggregation aggregation = newAggregation(// @@ -259,10 +258,7 @@ public class AggregationTests { assertThat(tagCount.size(), is(0)); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void shouldUnwindWithIndex() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -290,10 +286,7 @@ public class AggregationTests { assertThat(tagCount.size(), is(3)); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void shouldUnwindPreserveEmpty() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -321,7 +314,7 @@ public class AggregationTests { assertThat(tagCount.get(3), isBsonObject().notContaining("n")); } - @Test + @Test // DATAMONGO-586 public void shouldDetectResultMismatch() { createTagDocuments(); @@ -346,7 +339,7 @@ public class AggregationTests { assertTagCount(null, 0, tagCount.get(1)); } - @Test + @Test // DATAMONGO-586 public void complexAggregationFrameworkUsageLargestAndSmallestCitiesByState() { /* //complex mongodb aggregation framework example from http://docs.mongodb.org/manual/tutorial/aggregation-examples/#largest-and-smallest-cities-by-state @@ -454,7 +447,7 @@ public class AggregationTests { assertThat(lastZipInfoStats.biggestCity.population, is(70185)); } - @Test + @Test // DATAMONGO-586 public void findStatesWithPopulationOver10MillionAggregationExample() { /* //complex mongodb aggregation framework example from @@ -501,10 +494,10 @@ public class AggregationTests { } /** - * @see DATAMONGO-861 - * @see https://docs.mongodb.com/manual/reference/operator/aggregation/cond/#example + * @see MongoDB Aggregation + * Framework: $cond */ - @Test + @Test // DATAMONGO-861 public void aggregationUsingConditionalProjectionToCalculateDiscount() { /* @@ -554,10 +547,10 @@ public class AggregationTests { } /** - * @see DATAMONGO-861 - * @see https://docs.mongodb.com/manual/reference/operator/aggregation/ifNull/#example + * @see MongoDB Aggregation + * Framework: $ifNull */ - @Test + @Test // DATAMONGO-861 public void aggregationUsingIfNullToProjectSaneDefaults() { /* @@ -597,10 +590,7 @@ public class AggregationTests { assertThat(second.get("description"), is((Object) "Unspecified")); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void aggregationUsingConditionalProjection() { TypedAggregation aggregation = newAggregation(ZipInfo.class, // @@ -622,10 +612,7 @@ public class AggregationTests { assertThat(firstZipInfoStats.get("population"), is((Object) 6055)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void aggregationUsingNestedConditionalProjection() { TypedAggregation aggregation = newAggregation(ZipInfo.class, // @@ -648,10 +635,7 @@ public class AggregationTests { assertThat(firstZipInfoStats.get("population"), is((Object) 6055)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void aggregationUsingIfNullProjection() { mongoTemplate.insert(new LineItem("id", "caption", 0)); @@ -675,10 +659,7 @@ public class AggregationTests { assertThat((String) idonly.get("caption"), is(equalTo("unknown"))); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void aggregationUsingIfNullReplaceWithFieldReferenceProjection() { mongoTemplate.insert(new LineItem("id", "caption", 0)); @@ -702,10 +683,7 @@ public class AggregationTests { assertThat((String) idonly.get("caption"), is(equalTo("idonly"))); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void shouldAllowGroupingUsingConditionalExpressions() { mongoTemplate.dropCollection(CarPerson.class); @@ -749,9 +727,11 @@ public class AggregationTests { } /** - * @see http://docs.mongodb.org/manual/tutorial/aggregation-examples/#return-the-five-most-common-likes + * @see Return + * the Five Most Common “Likes” */ - @Test + @Test // DATAMONGO-586 public void returnFiveMostCommonLikesAggregationFrameworkExample() { createUserWithLikesDocuments(); @@ -783,7 +763,7 @@ public class AggregationTests { ); } - @Test + @Test // DATAMONGO-586 public void arithmenticOperatorsInProjectionExample() { Product product = new Product("P1", "A", 1.99, 3, 0.05, 0.19); @@ -825,10 +805,7 @@ public class AggregationTests { assertThat((Integer) resultList.get(0).get("spaceUnitsModSpaceUnits"), is(product.spaceUnits % product.spaceUnits)); } - /** - * @see DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void expressionsInProjectionExample() { Product product = new Product("P1", "A", 1.99, 3, 0.05, 0.19); @@ -860,10 +837,7 @@ public class AggregationTests { is((product.netPrice * 0.8 + 1.2) * 1.19)); } - /** - * @see DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void stringExpressionsInProjectionExample() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR)); @@ -885,10 +859,7 @@ public class AggregationTests { assertThat((String) resultList.get(0).get("name_bubu"), is(product.name + "_bubu")); } - /** - * @see DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void expressionsInProjectionExampleShowcase() { Product product = new Product("P1", "A", 1.99, 3, 0.05, 0.19); @@ -930,12 +901,11 @@ public class AggregationTests { } /** - * @see DATAMONGO-753 - * @see http - * ://stackoverflow.com/questions/18653574/spring-data-mongodb-aggregation-framework-invalid-reference-in-group - * -operati + * @see Spring + * Data MongoDB - Aggregation Framework - invalid reference in group Operation */ - @Test + @Test // DATAMONGO-753 public void allowsNestedFieldReferencesAsGroupIdsInGroupExpressions() { mongoTemplate.insert(new DATAMONGO753().withPDs(new PD("A", 1), new PD("B", 1), new PD("C", 1))); @@ -960,12 +930,11 @@ public class AggregationTests { } /** - * @see DATAMONGO-753 - * @see http - * ://stackoverflow.com/questions/18653574/spring-data-mongodb-aggregation-framework-invalid-reference-in-group - * -operati + * @see Spring + * Data MongoDB - Aggregation Framework - invalid reference in group Operation */ - @Test + @Test // DATAMONGO-753 public void aliasesNestedFieldInProjectionImmediately() { mongoTemplate.insert(new DATAMONGO753().withPDs(new PD("A", 1), new PD("B", 1), new PD("C", 1))); @@ -984,10 +953,7 @@ public class AggregationTests { } } - /** - * @DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void shouldPerformDateProjectionOperatorsCorrectly() throws ParseException { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR)); @@ -1016,10 +982,7 @@ public class AggregationTests { assertThat((String) dbo.get("toUpper"), is("ABC")); } - /** - * @DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void shouldPerformStringProjectionOperatorsCorrectly() throws ParseException { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR)); @@ -1058,10 +1021,7 @@ public class AggregationTests { assertThat((Integer) dbo.get("millisecond"), is(789)); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void shouldPerformReplaceRootOperatorCorrectly() throws ParseException { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR)); @@ -1084,10 +1044,7 @@ public class AggregationTests { assertThat((Integer) dbo.keySet().size(), is(1)); } - /** - * @see DATAMONGO-788 - */ - @Test + @Test // DATAMONGO-788 public void referencesToGroupIdsShouldBeRenderedProperly() { mongoTemplate.insert(new DATAMONGO788(1, 1)); @@ -1114,10 +1071,7 @@ public class AggregationTests { assertThat((Integer) items.get(1).get("y"), is(1)); } - /** - * @see DATAMONGO-806 - */ - @Test + @Test // DATAMONGO-806 public void shouldAllowGroupByIdFields() { mongoTemplate.dropCollection(User.class); @@ -1148,10 +1102,7 @@ public class AggregationTests { assertThat(String.valueOf(firstItem.get("_id")), is("u1")); } - /** - * @see DATAMONGO-840 - */ - @Test + @Test // DATAMONGO-840 public void shouldAggregateOrderDataToAnInvoice() { mongoTemplate.dropCollection(Order.class); @@ -1188,10 +1139,7 @@ public class AggregationTests { assertThat(invoice.getTotalAmount(), is(closeTo(9.877, 000001))); } - /** - * @see DATAMONGO-924 - */ - @Test + @Test // DATAMONGO-924 public void shouldAllowGroupingByAliasedFieldDefinedInFormerAggregationStage() { mongoTemplate.dropCollection(CarPerson.class); @@ -1222,10 +1170,7 @@ public class AggregationTests { assertThat(result.getMappedResults(), hasSize(3)); } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void returnFiveMostCommonLikesAggregationFrameworkExampleWithSortOnDiskOptionEnabled() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX)); @@ -1250,10 +1195,7 @@ public class AggregationTests { assertLikeStats(result.getMappedResults().get(4), "e", 3); } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void returnFiveMostCommonLikesShouldReturnStageExecutionInformationWithExplainOptionEnabled() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX)); @@ -1273,10 +1215,7 @@ public class AggregationTests { assertThat(rawResult.containsField("stages"), is(true)); } - /** - * @see DATAMONGO-954 - */ - @Test + @Test // DATAMONGO-954 public void shouldSupportReturningCurrentAggregationRoot() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX)); @@ -1301,11 +1240,9 @@ public class AggregationTests { } /** - * @see DATAMONGO-954 - * @see http - * ://stackoverflow.com/questions/24185987/using-root-inside-spring-data-mongodb-for-retrieving-whole-document + * {@link http://stackoverflow.com/questions/24185987/using-root-inside-spring-data-mongodb-for-retrieving-whole-document} */ - @Test + @Test // DATAMONGO-954 public void shouldSupportReturningCurrentAggregationRootInReference() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX)); @@ -1326,10 +1263,7 @@ public class AggregationTests { assertThat(result.getMappedResults(), hasSize(2)); } - /** - * @see DATAMONGO-1549 - */ - @Test + @Test // DATAMONGO-1549 public void shouldApplyCountCorrectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR)); @@ -1350,10 +1284,7 @@ public class AggregationTests { assertThat(dbObject, isBsonObject().containing("documents", 3).containing("twice", 6)); } - /** - * @see DATAMONGO-975 - */ - @Test + @Test // DATAMONGO-975 public void shouldRetrieveDateTimeFragementsCorrectly() throws Exception { mongoTemplate.dropCollection(ObjectWithDate.class); @@ -1405,10 +1336,7 @@ public class AggregationTests { assertThat(dbo.get("dayOfYearPlus1DayManually"), is((Object) dateTime.plusDays(1).getDayOfYear())); } - /** - * @see DATAMONGO-1127 - */ - @Test + @Test // DATAMONGO-1127 public void shouldSupportGeoNearQueriesForAggregationWithDistanceField() { mongoTemplate.insert(new Venue("Penn Station", -73.99408, 40.75057)); @@ -1429,10 +1357,7 @@ public class AggregationTests { assertThat((Double) firstResult.get("distance"), closeTo(117.620092203928, 0.00001)); } - /** - * @see DATAMONGO-1133 - */ - @Test + @Test // DATAMONGO-1133 public void shouldHonorFieldAliasesForFieldReferences() { mongoTemplate.insert(new MeterData("m1", "counter1", 42)); @@ -1452,10 +1377,7 @@ public class AggregationTests { assertThat(result.get("totalValue"), is(equalTo((Object) 100.0))); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void shouldLookupPeopleCorectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -1476,10 +1398,7 @@ public class AggregationTests { assertThat(firstItem, isBsonObject().containing("linkedPerson.[0].firstname", "u1")); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void shouldGroupByAndLookupPeopleCorectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -1501,10 +1420,7 @@ public class AggregationTests { assertThat(firstItem, isBsonObject().containing("linkedPerson.[0].firstname", "u1")); } - /** - * @see DATAMONGO-1418 - */ - @Test + @Test // DATAMONGO-1418 public void shouldCreateOutputCollection() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX)); @@ -1533,10 +1449,7 @@ public class AggregationTests { mongoTemplate.dropCollection(tempOutCollection); } - /** - * @see DATAMONGO-1418 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1418 public void outShouldOutBeTheLastOperation() { newAggregation(match(new Criteria()), // @@ -1545,10 +1458,7 @@ public class AggregationTests { skip(100L)); } - /** - * @see DATAMONGO-1457 - */ - @Test + @Test // DATAMONGO-1457 public void sliceShouldBeAppliedCorrectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -1566,10 +1476,7 @@ public class AggregationTests { } } - /** - * @see DATAMONGO-1491 - */ - @Test + @Test // DATAMONGO-1491 public void filterShouldBeAppliedCorrectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -1602,10 +1509,7 @@ public class AggregationTests { Sales.builder().id("2").items(Collections. emptyList()).build())); } - /** - * @see DATAMONGO-1538 - */ - @Test + @Test // DATAMONGO-1538 public void letShouldBeAppliedCorrectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO)); @@ -1632,10 +1536,7 @@ public class AggregationTests { new BasicDBObjectBuilder().add("_id", "2").add("finalTotal", 10.25D).get())); } - /** - * @see DATAMONGO-1551 - */ - @Test + @Test // DATAMONGO-1551 public void graphLookupShouldBeAppliedCorrectly() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR)); @@ -1666,10 +1567,7 @@ public class AggregationTests { assertThat((DBObject) list.get(1), isBsonObject().containing("name", "Eliot").containing("depth", 0L)); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void bucketShouldCollectDocumentsIntoABucket() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR)); @@ -1706,10 +1604,7 @@ public class AggregationTests { assertThat((Double) bound100.get("sum"), is(closeTo(3672.9, 0.1))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void bucketAutoShouldCollectDocumentsIntoABucket() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR)); @@ -1743,10 +1638,7 @@ public class AggregationTests { assertThat((Double) bound1.get("sum"), is(closeTo(1673.0, 0.1))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void facetShouldCreateFacets() { assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR)); @@ -1895,9 +1787,7 @@ public class AggregationTests { } } - /** - * @see DATAMONGO-806 - */ + // DATAMONGO-806 static class User { @Id String id; @@ -1911,9 +1801,7 @@ public class AggregationTests { } } - /** - * @see DATAMONGO-806 - */ + // DATAMONGO-806 static class PushMessage { @Id String id; @@ -2003,9 +1891,7 @@ public class AggregationTests { } } - /** - * @see DATAMONGO-861 - */ + // DATAMONGO-861 @Document(collection = "inventory") static class InventoryItem { @@ -2032,9 +1918,7 @@ public class AggregationTests { } } - /** - * @see DATAMONGO-1491 - */ + // DATAMONGO-1491 @lombok.Data @Builder static class Sales { @@ -2043,9 +1927,7 @@ public class AggregationTests { List items; } - /** - * @see DATAMONGO-1491 - */ + // DATAMONGO-1491 @lombok.Data @Builder static class Item { @@ -2056,9 +1938,7 @@ public class AggregationTests { Long price; } - /** - * @see DATAMONGO-1538 - */ + // DATAMONGO-1538 @lombok.Data @Builder static class Sales2 { @@ -2069,9 +1949,7 @@ public class AggregationTests { boolean applyDiscount; } - /** - * @see DATAMONGO-1551 - */ + // DATAMONGO-1551 @lombok.Data @Builder static class Employee { @@ -2081,9 +1959,7 @@ public class AggregationTests { String reportsTo; } - /** - * @see DATAMONGO-1552 - */ + // DATAMONGO-1552 @lombok.Data @Builder static class Art { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationUnitTests.java index 76b228acd..9af74d70f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationUnitTests.java @@ -70,10 +70,7 @@ public class AggregationUnitTests { newAggregation(String.class, new AggregationOperation[0]); } - /** - * @see DATAMONGO-753 - */ - @Test + @Test // DATAMONGO-753 public void checkForCorrectFieldScopeTransfer() { exception.expect(IllegalArgumentException.class); @@ -87,10 +84,7 @@ public class AggregationUnitTests { ).toDbObject("foo", Aggregation.DEFAULT_CONTEXT); // -> triggers IllegalArgumentException } - /** - * @see DATAMONGO-753 - */ - @Test + @Test // DATAMONGO-753 public void unwindOperationShouldNotChangeAvailableFields() { newAggregation( // @@ -100,10 +94,7 @@ public class AggregationUnitTests { ).toDbObject("foo", Aggregation.DEFAULT_CONTEXT); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindOperationWithIndexShouldPreserveFields() { newAggregation( // @@ -113,10 +104,7 @@ public class AggregationUnitTests { ).toDbObject("foo", Aggregation.DEFAULT_CONTEXT); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindOperationWithIndexShouldAddIndexField() { newAggregation( // @@ -126,10 +114,7 @@ public class AggregationUnitTests { ).toDbObject("foo", Aggregation.DEFAULT_CONTEXT); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void fullUnwindOperationShouldBuildCorrectClause() { DBObject agg = newAggregation( // @@ -143,10 +128,7 @@ public class AggregationUnitTests { containing("preserveNullAndEmptyArrays", true)); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindOperationWithPreserveNullShouldBuildCorrectClause() { DBObject agg = newAggregation( // @@ -158,10 +140,7 @@ public class AggregationUnitTests { isBsonObject().notContaining("includeArrayIndex").containing("preserveNullAndEmptyArrays", true)); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void replaceRootOperationShouldBuildCorrectClause() { DBObject agg = newAggregation( // @@ -173,10 +152,7 @@ public class AggregationUnitTests { assertThat(unwind, isBsonObject().containing("$replaceRoot.newRoot", new BasicDBObject("field", "value"))); } - /** - * @see DATAMONGO-753 - */ - @Test + @Test // DATAMONGO-753 public void matchOperationShouldNotChangeAvailableFields() { newAggregation( // @@ -186,10 +162,7 @@ public class AggregationUnitTests { ).toDbObject("foo", Aggregation.DEFAULT_CONTEXT); } - /** - * @see DATAMONGO-788 - */ - @Test + @Test // DATAMONGO-788 public void referencesToGroupIdsShouldBeRenderedAsReferences() { DBObject agg = newAggregation( // @@ -205,10 +178,7 @@ public class AggregationUnitTests { assertThat(fields.get("a"), is((Object) "$_id.a")); } - /** - * @see DATAMONGO-791 - */ - @Test + @Test // DATAMONGO-791 public void allowAggregationOperationsToBePassedAsIterable() { List ops = new ArrayList(); @@ -225,10 +195,7 @@ public class AggregationUnitTests { assertThat(fields.get("a"), is((Object) "$_id.a")); } - /** - * @see DATAMONGO-791 - */ - @Test + @Test // DATAMONGO-791 public void allowTypedAggregationOperationsToBePassedAsIterable() { List ops = new ArrayList(); @@ -245,10 +212,7 @@ public class AggregationUnitTests { assertThat(fields.get("a"), is((Object) "$_id.a")); } - /** - * @see DATAMONGO-838 - */ - @Test + @Test // DATAMONGO-838 public void expressionBasedFieldsShouldBeReferencableInFollowingOperations() { DBObject agg = newAggregation( // @@ -262,10 +226,7 @@ public class AggregationUnitTests { assertThat(fields.get("foosum"), is((Object) new BasicDBObject("$sum", "$foo"))); } - /** - * @see DATAMONGO-908 - */ - @Test + @Test // DATAMONGO-908 public void shouldSupportReferingToNestedPropertiesInGroupOperation() { DBObject agg = newAggregation( // @@ -283,10 +244,7 @@ public class AggregationUnitTests { assertThat(id.get("ruleType"), is((Object) "$rules.ruleType")); } - /** - * @see DATAMONGO-1585 - */ - @Test + @Test // DATAMONGO-1585 public void shouldSupportSortingBySyntheticAndExposedGroupFields() { DBObject agg = newAggregation( // @@ -301,10 +259,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(sort, "$sort"), is(JSON.parse("{ \"_id.cmsParameterId\" : 1 , \"titles\" : 1}"))); } - /** - * @see DATAMONGO-1585 - */ - @Test + @Test // DATAMONGO-1585 public void shouldSupportSortingByProjectedFields() { DBObject agg = newAggregation( // @@ -324,10 +279,7 @@ public class AggregationUnitTests { .containing("alias", 1)); } - /** - * @see DATAMONGO-924 - */ - @Test + @Test // DATAMONGO-924 public void referencingProjectionAliasesFromPreviousStepShouldReferToTheSameFieldTarget() { DBObject agg = newAggregation( // @@ -342,10 +294,7 @@ public class AggregationUnitTests { assertThat(projection1, is((DBObject) new BasicDBObject("b", "$ba"))); } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void shouldRenderAggregationWithDefaultOptionsCorrectly() { DBObject agg = newAggregation( // @@ -356,10 +305,7 @@ public class AggregationUnitTests { is("{ \"aggregate\" : \"foo\" , \"pipeline\" : [ { \"$project\" : { \"aa\" : \"$a\"}}]}")); } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void shouldRenderAggregationWithCustomOptionsCorrectly() { AggregationOptions aggregationOptions = newAggregationOptions().explain(true).cursor(new BasicDBObject("foo", 1)) @@ -380,10 +326,7 @@ public class AggregationUnitTests { )); } - /** - * @see DATAMONGO-954, DATAMONGO-1585 - */ - @Test + @Test // DATAMONGO-954, DATAMONGO-1585 public void shouldSupportReferencingSystemVariables() { DBObject agg = newAggregation( // @@ -406,10 +349,7 @@ public class AggregationUnitTests { is((DBObject) new BasicDBObject("_id", "$someKey").append("doc", new BasicDBObject("$first", "$$ROOT")))); } - /** - * @see DATAMONGO-1254 - */ - @Test + @Test // DATAMONGO-1254 public void shouldExposeAliasedFieldnameForProjectionsIncludingOperationsDownThePipeline() { DBObject agg = Aggregation.newAggregation(// @@ -423,10 +363,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(group, "count"), is(new BasicDBObjectBuilder().add("$sum", "$tags_count").get())); } - /** - * @see DATAMONGO-1254 - */ - @Test + @Test // DATAMONGO-1254 public void shouldUseAliasedFieldnameForProjectionsIncludingOperationsDownThePipelineWhenUsingSpEL() { DBObject agg = Aggregation.newAggregation(// @@ -440,10 +377,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(group, "count"), is(new BasicDBObjectBuilder().add("$sum", "$tags_count").get())); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void conditionExpressionBasedFieldsShouldBeReferencableInFollowingOperations() { DBObject agg = newAggregation( // @@ -461,10 +395,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(fields, "foosum"), isBsonObject().containing("$first.$cond.else", "no-answer")); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void shouldRenderProjectionConditionalExpressionCorrectly() { DBObject agg = Aggregation.newAggregation(// @@ -483,10 +414,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(project, "color"), isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void shouldRenderProjectionConditionalCorrectly() { DBObject agg = Aggregation.newAggregation(// @@ -506,10 +434,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(project, "color"), isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void shouldRenderProjectionConditionalWithCriteriaCorrectly() { DBObject agg = Aggregation @@ -528,10 +453,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(project, "color"), isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void referencingProjectionAliasesShouldRenderProjectionConditionalWithFieldReferenceCorrectly() { DBObject agg = Aggregation @@ -553,10 +475,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(project, "luminosity"), isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void referencingProjectionAliasesShouldRenderProjectionConditionalWithCriteriaReferenceCorrectly() { DBObject agg = Aggregation @@ -578,10 +497,7 @@ public class AggregationUnitTests { assertThat(getAsDBObject(project, "luminosity"), isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void shouldRenderProjectionIfNullWithFieldReferenceCorrectly() { DBObject agg = Aggregation @@ -599,10 +515,7 @@ public class AggregationUnitTests { isBsonObject().containing("$ifNull", Arrays. asList("$chroma", "unknown"))); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void shouldRenderProjectionIfNullWithFallbackFieldReferenceCorrectly() { DBObject agg = Aggregation @@ -619,10 +532,7 @@ public class AggregationUnitTests { isBsonObject().containing("$ifNull", Arrays.asList("$chroma", "$fallback"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldHonorDefaultCountField() { DBObject agg = Aggregation @@ -636,10 +546,7 @@ public class AggregationUnitTests { assertThat(project, isBsonObject().containing("count", 1)); } - /** - * @see DATAMONGO-1533 - */ - @Test + @Test // DATAMONGO-1533 public void groupOperationShouldAllowUsageOfDerivedSpELAggregationExpression() { DBObject agg = newAggregation( // diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java index 19459dc09..30fe6f158 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,26 +33,17 @@ import com.mongodb.util.JSON; */ public class BucketAutoOperationUnitTests { - /** - * @see DATAMONGO-1552 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1552 public void rejectsNullFields() { new BucketAutoOperation((Field) null, 0); } - /** - * @see DATAMONGO-1552 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1552 public void rejectsNonPositiveIntegerNullFields() { new BucketAutoOperation(Fields.field("field"), 0); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderBucketOutputExpressions() { BucketAutoOperation operation = Aggregation.bucketAuto("field", 5) // @@ -64,18 +55,12 @@ public class BucketAutoOperationUnitTests { "{ \"grossSalesPrice\" : { \"$multiply\" : [ { \"$add\" : [ \"$netPrice\" , \"$surCharge\"]} , \"$taxrate\" , 2]} , \"titles\" : { $push: \"$title\" } }}"))); } - /** - * @see DATAMONGO-1552 - */ - @Test(expected = IllegalStateException.class) + @Test(expected = IllegalStateException.class) // DATAMONGO-1552 public void shouldRenderEmptyAggregationExpression() { bucket("groupby").andOutput("field").as("alias"); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderBucketOutputOperators() { BucketAutoOperation operation = Aggregation.bucketAuto("field", 5) // @@ -85,10 +70,7 @@ public class BucketAutoOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ titles : { $sum: 1 } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderCorrectly() { DBObject agg = bucketAuto("field", 1).withBuckets(5).toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -96,10 +78,7 @@ public class BucketAutoOperationUnitTests { assertThat(agg, is(JSON.parse("{ $bucketAuto: { groupBy: \"$field\", buckets: 5 } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderGranulariy() { DBObject agg = bucketAuto("field", 1) // @@ -109,10 +88,7 @@ public class BucketAutoOperationUnitTests { assertThat(agg, is(JSON.parse("{ $bucketAuto: { buckets: 1, granularity: \"E24\", groupBy: \"$field\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumOperator() { BucketAutoOperation operation = bucketAuto("field", 5) // @@ -122,10 +98,7 @@ public class BucketAutoOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ cummulated_score : { $sum: \"$score\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumWithOwnOutputExpression() { BucketAutoOperation operation = bucketAuto("field", 5) // diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java index 989267e7b..f6d50bc87 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,18 +33,12 @@ import com.mongodb.util.JSON; */ public class BucketOperationUnitTests { - /** - * @see DATAMONGO-1552 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1552 public void rejectsNullFields() { new BucketOperation((Field) null); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderBucketOutputExpressions() { BucketOperation operation = Aggregation.bucket("field") // @@ -56,18 +50,12 @@ public class BucketOperationUnitTests { "{ \"grossSalesPrice\" : { \"$multiply\" : [ { \"$add\" : [ \"$netPrice\" , \"$surCharge\"]} , \"$taxrate\" , 2]} , \"titles\" : { $push: \"$title\" } }}"))); } - /** - * @see DATAMONGO-1552 - */ - @Test(expected = IllegalStateException.class) + @Test(expected = IllegalStateException.class) // DATAMONGO-1552 public void shouldRenderEmptyAggregationExpression() { bucket("groupby").andOutput("field").as("alias"); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderBucketOutputOperators() { BucketOperation operation = Aggregation.bucket("field") // @@ -77,10 +65,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ titles : { $sum: 1 } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumAggregationExpression() { DBObject agg = bucket("field") // @@ -91,10 +76,7 @@ public class BucketOperationUnitTests { "{ $bucket: { groupBy: \"$field\", boundaries: [], output : { quizTotal: { $sum: \"$quizzes\"} } } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderDefault() { DBObject agg = bucket("field").withDefaultBucket("default bucket").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -103,10 +85,7 @@ public class BucketOperationUnitTests { is(JSON.parse("{ $bucket: { groupBy: \"$field\", boundaries: [], default: \"default bucket\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderBoundaries() { DBObject agg = bucket("field") // @@ -118,10 +97,7 @@ public class BucketOperationUnitTests { is(JSON.parse("{ $bucket: { boundaries: [0, 10, 20], default: \"default bucket\", groupBy: \"$field\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumOperator() { BucketOperation operation = bucket("field") // @@ -131,10 +107,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ cummulated_score : { $sum: \"$score\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumWithValueOperator() { BucketOperation operation = bucket("field") // @@ -144,10 +117,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ cummulated_score : { $sum: 4 } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderAvgOperator() { BucketOperation operation = bucket("field") // @@ -157,10 +127,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ average : { $avg: \"$score\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderFirstOperator() { BucketOperation operation = bucket("field") // @@ -170,10 +137,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ first_title : { $first: \"$title\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderLastOperator() { BucketOperation operation = bucket("field") // @@ -183,10 +147,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ last_title : { $last: \"$title\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderMinOperator() { BucketOperation operation = bucket("field") // @@ -196,10 +157,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ min_score : { $min: \"$score\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderPushOperator() { BucketOperation operation = bucket("field") // @@ -209,10 +167,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ titles : { $push: \"$title\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderAddToSetOperator() { BucketOperation operation = bucket("field") // @@ -222,10 +177,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ titles : { $addToSet: \"$title\" } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumWithExpression() { BucketOperation operation = bucket("field") // @@ -235,10 +187,7 @@ public class BucketOperationUnitTests { assertThat(extractOutput(dbObject), is(JSON.parse("{ total : { $sum: { $add : [\"$netPrice\", \"$tax\"]} } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderSumWithOwnOutputExpression() { BucketOperation operation = bucket("field") // @@ -249,10 +198,7 @@ public class BucketOperationUnitTests { is(JSON.parse("{ total : { $multiply: [ {$add : [\"$netPrice\", \"$tax\"]}, 5] } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldExposeDefaultCountField() { BucketOperation operation = bucket("field"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CondExpressionUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CondExpressionUnitTests.java index 009cf79e4..45afe8873 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CondExpressionUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CondExpressionUnitTests.java @@ -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. @@ -36,42 +36,27 @@ import com.mongodb.DBObject; */ public class CondExpressionUnitTests { - /** - * @see DATAMONGO-861 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-861 public void builderRejectsEmptyFieldName() { newBuilder().when(""); } - /** - * @see DATAMONGO-861 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-861 public void builderRejectsNullFieldName() { newBuilder().when((DBObject) null); } - /** - * @see DATAMONGO-861 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-861 public void builderRejectsNullCriteriaName() { newBuilder().when((Criteria) null); } - /** - * @see DATAMONGO-861 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-861 public void builderRejectsBuilderAsThenValue() { newBuilder().when("isYellow").then(newBuilder().when("field").then("then-value")).otherwise("otherwise"); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void simpleBuilderShouldRenderCorrectly() { Cond operator = ConditionalOperators.when("isYellow").thenValueOf("bright").otherwise("dark"); @@ -85,10 +70,7 @@ public class CondExpressionUnitTests { assertThat(dbObject, isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void simpleCriteriaShouldRenderCorrectly() { Cond operator = ConditionalOperators.when(Criteria.where("luminosity").gte(100)).thenValueOf("bright") @@ -103,10 +85,7 @@ public class CondExpressionUnitTests { assertThat(dbObject, isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void andCriteriaShouldRenderCorrectly() { Cond operator = ConditionalOperators.when(Criteria.where("luminosity").gte(100) // @@ -128,10 +107,7 @@ public class CondExpressionUnitTests { assertThat(dbObject, isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void twoArgsCriteriaShouldRenderCorrectly() { Criteria criteria = Criteria.where("luminosity").gte(100) // @@ -151,10 +127,7 @@ public class CondExpressionUnitTests { assertThat(dbObject, isBsonObject().containing("$cond", expectedCondition)); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void nestedCriteriaShouldRenderCorrectly() { Cond operator = ConditionalOperators.when(Criteria.where("luminosity").gte(100)) // diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CountOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CountOperationUnitTests.java index a91441558..73a2201d9 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CountOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/CountOperationUnitTests.java @@ -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. @@ -29,28 +29,19 @@ import com.mongodb.util.JSON; */ public class CountOperationUnitTests { - /** - * @see DATAMONGO-1549 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1549 public void rejectsEmptyFieldName() { new CountOperation(""); } - /** - * @see DATAMONGO-1549 - */ - @Test + @Test // DATAMONGO-1549 public void shouldRenderCorrectly() { CountOperation countOperation = new CountOperation("field"); assertThat(countOperation.toDBObject(Aggregation.DEFAULT_CONTEXT), is(JSON.parse("{$count : \"field\" }"))); } - /** - * @see DATAMONGO-1549 - */ - @Test + @Test // DATAMONGO-1549 public void countExposesFields() { CountOperation countOperation = new CountOperation("field"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java index 228102b7c..83b5f8ab6 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,10 +33,7 @@ import com.mongodb.util.JSON; */ public class FacetOperationUnitTests { - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderCorrectly() throws Exception { FacetOperation facetOperation = new FacetOperation() @@ -58,10 +55,7 @@ public class FacetOperationUnitTests { + "categorizedByYears: [ { $bucketAuto: { buckets: 5, groupBy: \"$year\" } } ] } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldRenderEmpty() throws Exception { FacetOperation facetOperation = facet(); @@ -71,10 +65,7 @@ public class FacetOperationUnitTests { assertThat(dbObject, is(JSON.parse("{ $facet: { } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1552 public void shouldRejectNonExistingFields() throws Exception { FacetOperation facetOperation = new FacetOperation() @@ -95,10 +86,7 @@ public class FacetOperationUnitTests { + "categorizedByYears: [ { $bucketAuto: { buckets: 5, groupBy: \"$year\" } } ] } }"))); } - /** - * @see DATAMONGO-1552 - */ - @Test + @Test // DATAMONGO-1552 public void shouldHonorProjectedFields() { FacetOperation facetOperation = new FacetOperation() diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FieldsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FieldsUnitTests.java index 77cd20020..014e0dd95 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FieldsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FieldsUnitTests.java @@ -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. @@ -106,28 +106,19 @@ public class FieldsUnitTests { fields("b", "a.b"); } - /** - * @see DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void stripsLeadingDollarsFromName() { assertThat(Fields.field("$name").getName(), is("name")); assertThat(Fields.field("$$$$name").getName(), is("name")); } - /** - * @see DATAMONGO-774 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-774 public void rejectsNameConsistingOfDollarOnly() { Fields.field("$"); } - /** - * @see DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void stripsLeadingDollarsFromTarget() { assertThat(Fields.field("$target").getTarget(), is("target")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FilterExpressionUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FilterExpressionUnitTests.java index 6bb721904..e2b389327 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FilterExpressionUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FilterExpressionUnitTests.java @@ -56,10 +56,7 @@ public class FilterExpressionUnitTests { new QueryMapper(new MappingMongoConverter(new DefaultDbRefResolver(mongoDbFactory), mappingContext))); } - /** - * @see DATAMONGO-1491 - */ - @Test + @Test // DATAMONGO-1491 public void shouldConstructFilterExpressionCorrectly() { TypedAggregation agg = Aggregation.newAggregation(Sales.class, @@ -83,10 +80,7 @@ public class FilterExpressionUnitTests { assertThat($filter, is(expected)); } - /** - * @see DATAMONGO-1491 - */ - @Test + @Test // DATAMONGO-1491 public void shouldConstructFilterExpressionCorrectlyWhenUsingFilterOnProjectionBuilder() { TypedAggregation agg = Aggregation.newAggregation(Sales.class, Aggregation.project().and("items") @@ -108,10 +102,7 @@ public class FilterExpressionUnitTests { assertThat($filter, is(expected)); } - /** - * @see DATAMONGO-1491 - */ - @Test + @Test // DATAMONGO-1491 public void shouldConstructFilterExpressionCorrectlyWhenInputMapToArray() { TypedAggregation agg = Aggregation.newAggregation(Sales.class, diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GeoNearOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GeoNearOperationUnitTests.java index 95e2f13a7..f676ed5a9 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GeoNearOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GeoNearOperationUnitTests.java @@ -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. @@ -33,10 +33,7 @@ import com.mongodb.DBObject; */ public class GeoNearOperationUnitTests { - /** - * @see DATAMONGO-1127 - */ - @Test + @Test // DATAMONGO-1127 public void rendersNearQueryAsAggregationOperation() { NearQuery query = NearQuery.near(10.0, 10.0); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperationUnitTests.java index 3400911a8..f4e91860f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperationUnitTests.java @@ -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. @@ -35,18 +35,12 @@ import com.mongodb.util.JSON; */ public class GraphLookupOperationUnitTests { - /** - * @see DATAMONGO-1551 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1551 public void rejectsNullFromCollection() { GraphLookupOperation.builder().from(null); } - /** - * @see DATAMONGO-1551 - */ - @Test + @Test // DATAMONGO-1551 public void shouldRenderCorrectly() { GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() // @@ -63,10 +57,7 @@ public class GraphLookupOperationUnitTests { isBsonObject().containing("$graphLookup.depthField", "depth").containing("$graphLookup.maxDepth", 42L)); } - /** - * @see DATAMONGO-1551 - */ - @Test + @Test // DATAMONGO-1551 public void shouldRenderCriteriaCorrectly() { GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() // @@ -82,10 +73,7 @@ public class GraphLookupOperationUnitTests { isBsonObject().containing("$graphLookup.restrictSearchWithMatch", new BasicDBObject("key", "value"))); } - /** - * @see DATAMONGO-1551 - */ - @Test + @Test // DATAMONGO-1551 public void shouldRenderArrayOfStartsWithCorrectly() { GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() // @@ -102,10 +90,7 @@ public class GraphLookupOperationUnitTests { + "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }"))); } - /** - * @see DATAMONGO-1551 - */ - @Test + @Test // DATAMONGO-1551 public void shouldRenderMixedArrayOfStartsWithCorrectly() { GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() // @@ -122,10 +107,7 @@ public class GraphLookupOperationUnitTests { + "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }"))); } - /** - * @see DATAMONGO-1551 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1551 public void shouldRejectUnknownTypeInMixedArrayOfStartsWithCorrectly() { GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() // @@ -136,10 +118,7 @@ public class GraphLookupOperationUnitTests { .as("reportingHierarchy"); } - /** - * @see DATAMONGO-1551 - */ - @Test + @Test // DATAMONGO-1551 public void shouldRenderStartWithAggregationExpressions() { GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() // diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GroupOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GroupOperationUnitTests.java index 0bb274e85..ad765224c 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GroupOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/GroupOperationUnitTests.java @@ -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. @@ -42,10 +42,7 @@ public class GroupOperationUnitTests { new GroupOperation((Fields) null); } - /** - * @see DATAMONGO-759 - */ - @Test + @Test // DATAMONGO-759 public void groupOperationWithNoGroupIdFieldsShouldGenerateNullAsGroupId() { GroupOperation operation = new GroupOperation(Fields.from()); @@ -57,10 +54,7 @@ public class GroupOperationUnitTests { assertThat(groupClause.get(UNDERSCORE_ID), is(nullValue())); } - /** - * @see DATAMONGO-759 - */ - @Test + @Test // DATAMONGO-759 public void groupOperationWithNoGroupIdFieldsButAdditionalFieldsShouldGenerateNullAsGroupId() { GroupOperation operation = new GroupOperation(Fields.from()).count().as("cnt").last("foo").as("foo"); @@ -188,10 +182,7 @@ public class GroupOperationUnitTests { assertThat(push, is((DBObject) new BasicDBObject("$addToSet", 42))); } - /** - * @see DATAMONGO-979 - */ - @Test + @Test // DATAMONGO-979 public void shouldRenderSizeExpressionInGroup() { GroupOperation groupOperation = Aggregation // @@ -205,10 +196,7 @@ public class GroupOperationUnitTests { assertThat(tagsCount.get("$first"), is((Object) new BasicDBObject("$size", Arrays.asList("$tags")))); } - /** - * @see DATAMONGO-1327 - */ - @Test + @Test // DATAMONGO-1327 public void groupOperationStdDevSampWithValue() { GroupOperation groupOperation = Aggregation.group("a", "b").stdDevSamp("field").as("fieldStdDevSamp"); @@ -219,10 +207,7 @@ public class GroupOperationUnitTests { assertThat(push, is((DBObject) new BasicDBObject("$stdDevSamp", "$field"))); } - /** - * @see DATAMONGO-1327 - */ - @Test + @Test // DATAMONGO-1327 public void groupOperationStdDevPopWithValue() { GroupOperation groupOperation = Aggregation.group("a", "b").stdDevPop("field").as("fieldStdDevPop"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/LookupOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/LookupOperationUnitTests.java index 9ff31ecaa..2784f172d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/LookupOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/LookupOperationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,42 +33,27 @@ import com.mongodb.DBObject; */ public class LookupOperationUnitTests { - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void rejectsNullForFrom() { new LookupOperation(null, Fields.field("localField"), Fields.field("foreignField"), Fields.field("as")); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void rejectsNullLocalFieldField() { new LookupOperation(Fields.field("from"), null, Fields.field("foreignField"), Fields.field("as")); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void rejectsNullForeignField() { new LookupOperation(Fields.field("from"), Fields.field("localField"), null, Fields.field("as")); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void rejectsNullForAs() { new LookupOperation(Fields.field("from"), Fields.field("localField"), Fields.field("foreignField"), null); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void lookupOperationWithValues() { LookupOperation lookupOperation = Aggregation.lookup("a", "b", "c", "d"); @@ -82,10 +67,7 @@ public class LookupOperationUnitTests { .containing("as", "d")); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void lookupOperationExposesAsField() { LookupOperation lookupOperation = Aggregation.lookup("a", "b", "c", "d"); @@ -102,42 +84,27 @@ public class LookupOperationUnitTests { return lookupClause; } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void builderRejectsNullFromField() { LookupOperation.newLookup().from(null); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void builderRejectsNullLocalField() { LookupOperation.newLookup().from("a").localField(null); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void builderRejectsNullForeignField() { LookupOperation.newLookup().from("a").localField("b").foreignField(null); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void builderRejectsNullAsField() { LookupOperation.newLookup().from("a").localField("b").foreignField("c").as(null); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void lookupBuilderBuildsCorrectClause() { LookupOperation lookupOperation = LookupOperation.newLookup().from("a").localField("b").foreignField("c").as("d"); @@ -151,10 +118,7 @@ public class LookupOperationUnitTests { .containing("as", "d")); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void lookupBuilderExposesFields() { LookupOperation lookupOperation = LookupOperation.newLookup().from("a").localField("b").foreignField("c").as("d"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/OutOperationUnitTest.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/OutOperationUnitTest.java index 0d5775d35..485eea0a2 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/OutOperationUnitTest.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/OutOperationUnitTest.java @@ -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. @@ -24,10 +24,7 @@ import org.junit.Test; */ public class OutOperationUnitTest { - /** - * @see DATAMONGO-1418 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1418 public void shouldCheckNPEInCreation() { new OutOperation(null); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperationUnitTests.java index 256c0282c..668f1feb1 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperationUnitTests.java @@ -60,18 +60,12 @@ public class ProjectionOperationUnitTests { static final String DIVIDE = "$divide"; static final String PROJECT = "$project"; - /** - * @see DATAMONGO-586 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-586 public void rejectsNullFields() { new ProjectionOperation(null); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void declaresBackReferenceCorrectly() { ProjectionOperation operation = new ProjectionOperation(); @@ -82,10 +76,7 @@ public class ProjectionOperationUnitTests { assertThat(projectClause.get("prop"), is((Object) Fields.UNDERSCORE_ID_REF)); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void alwaysUsesExplicitReference() { ProjectionOperation operation = new ProjectionOperation(Fields.fields("foo").and("bar", "foobar")); @@ -97,10 +88,7 @@ public class ProjectionOperationUnitTests { assertThat(projectClause.get("bar"), is((Object) "$foobar")); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void aliasesSimpleFieldProjection() { ProjectionOperation operation = new ProjectionOperation(); @@ -111,10 +99,7 @@ public class ProjectionOperationUnitTests { assertThat(projectClause.get("bar"), is((Object) "$foo")); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void aliasesArithmeticProjection() { ProjectionOperation operation = new ProjectionOperation(); @@ -129,10 +114,7 @@ public class ProjectionOperationUnitTests { assertThat(addClause.get(1), is((Object) 41)); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void arithmenticProjectionOperationWithoutAlias() { String fieldName = "a"; @@ -145,10 +127,7 @@ public class ProjectionOperationUnitTests { assertThat(oper.get(ADD), is((Object) Arrays. asList("$a", 1))); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void arithmenticProjectionOperationPlus() { String fieldName = "a"; @@ -162,10 +141,7 @@ public class ProjectionOperationUnitTests { assertThat(oper.get(ADD), is((Object) Arrays. asList("$a", 1))); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void arithmenticProjectionOperationMinus() { String fieldName = "a"; @@ -179,10 +155,7 @@ public class ProjectionOperationUnitTests { assertThat(oper.get(SUBTRACT), is((Object) Arrays. asList("$a", 1))); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void arithmenticProjectionOperationMultiply() { String fieldName = "a"; @@ -196,10 +169,7 @@ public class ProjectionOperationUnitTests { assertThat(oper.get(MULTIPLY), is((Object) Arrays. asList("$a", 1))); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void arithmenticProjectionOperationDivide() { String fieldName = "a"; @@ -213,19 +183,13 @@ public class ProjectionOperationUnitTests { assertThat(oper.get(DIVIDE), is((Object) Arrays. asList("$a", 1))); } - /** - * @see DATAMONGO-586 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-586 public void arithmenticProjectionOperationDivideByZeroException() { new ProjectionOperation().and("a").divide(0); } - /** - * @see DATAMONGO-586 - */ - @Test + @Test // DATAMONGO-586 public void arithmenticProjectionOperationMod() { String fieldName = "a"; @@ -239,19 +203,13 @@ public class ProjectionOperationUnitTests { assertThat(oper.get(MOD), is((Object) Arrays. asList("$a", 3))); } - /** - * @see DATAMONGO-758 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-758 public void excludeShouldThrowExceptionForFieldsOtherThanUnderscoreId() { new ProjectionOperation().andExclude("foo"); } - /** - * @see DATAMONGO-758 - */ - @Test + @Test // DATAMONGO-758 public void excludeShouldAllowExclusionOfUnderscoreId() { ProjectionOperation projectionOp = new ProjectionOperation().andExclude(Fields.UNDERSCORE_ID); @@ -260,10 +218,7 @@ public class ProjectionOperationUnitTests { assertThat((Integer) projectClause.get(Fields.UNDERSCORE_ID), is(0)); } - /** - * @see DATAMONGO-757 - */ - @Test + @Test // DATAMONGO-757 public void usesImplictAndExplicitFieldAliasAndIncludeExclude() { ProjectionOperation operation = Aggregation.project("foo").and("foobar").as("bar").andInclude("inc1", "inc2") @@ -285,10 +240,7 @@ public class ProjectionOperationUnitTests { new ProjectionOperation().and("a").mod(0); } - /** - * @see DATAMONGO-769 - */ - @Test + @Test // DATAMONGO-769 public void allowArithmeticOperationsWithFieldReferences() { ProjectionOperation operation = Aggregation.project() // @@ -313,10 +265,7 @@ public class ProjectionOperationUnitTests { is(new BasicDBObject("$mod", dbList("$foo", "$bar")))); } - /** - * @see DATAMONGO-774 - */ - @Test + @Test // DATAMONGO-774 public void projectionExpressions() { ProjectionOperation operation = Aggregation.project() // @@ -328,10 +277,7 @@ public class ProjectionOperationUnitTests { "{ \"$project\" : { \"grossSalesPrice\" : { \"$multiply\" : [ { \"$add\" : [ \"$netPrice\" , \"$surCharge\"]} , \"$taxrate\" , 2]} , \"bar\" : \"$foo\"}}")); } - /** - * @see DATAMONGO-975 - */ - @Test + @Test // DATAMONGO-975 public void shouldRenderDateTimeFragmentExtractionsForSimpleFieldProjectionsCorrectly() { ProjectionOperation operation = Aggregation.project() // @@ -364,10 +310,7 @@ public class ProjectionOperationUnitTests { assertThat(projected.get("dayOfWeek"), is((Object) new BasicDBObject("$dayOfWeek", Arrays.asList("$date")))); } - /** - * @see DATAMONGO-975 - */ - @Test + @Test // DATAMONGO-975 public void shouldRenderDateTimeFragmentExtractionsForExpressionProjectionsCorrectly() throws Exception { ProjectionOperation operation = Aggregation.project() // @@ -384,10 +327,7 @@ public class ProjectionOperationUnitTests { Arrays.asList(new BasicDBObject("$add", Arrays. asList("$date", 86400000)))))); } - /** - * @see DATAMONGO-979 - */ - @Test + @Test // DATAMONGO-979 public void shouldRenderSizeExpressionInProjection() { ProjectionOperation operation = Aggregation // @@ -402,10 +342,7 @@ public class ProjectionOperationUnitTests { assertThat(projected.get("tags_count"), is((Object) new BasicDBObject("$size", Arrays.asList("$tags")))); } - /** - * @see DATAMONGO-979 - */ - @Test + @Test // DATAMONGO-979 public void shouldRenderGenericSizeExpressionInProjection() { ProjectionOperation operation = Aggregation // @@ -419,10 +356,7 @@ public class ProjectionOperationUnitTests { assertThat(projected.get("tags_count"), is((Object) new BasicDBObject("$size", Arrays.asList("$tags")))); } - /** - * @see DATAMONGO-1457 - */ - @Test + @Test // DATAMONGO-1457 public void shouldRenderSliceCorrectly() throws Exception { ProjectionOperation operation = Aggregation.project().and("field").slice(10).as("renamed"); @@ -434,10 +368,7 @@ public class ProjectionOperationUnitTests { is((Object) new BasicDBObject("$slice", Arrays. asList("$field", 10)))); } - /** - * @see DATAMONGO-1457 - */ - @Test + @Test // DATAMONGO-1457 public void shouldRenderSliceWithPositionCorrectly() throws Exception { ProjectionOperation operation = Aggregation.project().and("field").slice(10, 5).as("renamed"); @@ -449,10 +380,7 @@ public class ProjectionOperationUnitTests { is((Object) new BasicDBObject("$slice", Arrays. asList("$field", 5, 10)))); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderCmpCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").cmp(10).as("cmp10"); @@ -461,10 +389,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.cmp10.$cmp.[0]", "$field").containing("$project.cmp10.$cmp.[1]", 10)); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderEqCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").eq(10).as("eq10"); @@ -473,10 +398,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.eq10.$eq.[0]", "$field").containing("$project.eq10.$eq.[1]", 10)); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderGtCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").gt(10).as("gt10"); @@ -485,10 +407,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.gt10.$gt.[0]", "$field").containing("$project.gt10.$gt.[1]", 10)); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderGteCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").gte(10).as("gte10"); @@ -497,10 +416,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.gte10.$gte.[0]", "$field").containing("$project.gte10.$gte.[1]", 10)); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderLtCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").lt(10).as("lt10"); @@ -509,10 +425,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.lt10.$lt.[0]", "$field").containing("$project.lt10.$lt.[1]", 10)); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderLteCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").lte(10).as("lte10"); @@ -521,10 +434,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.lte10.$lte.[0]", "$field").containing("$project.lte10.$lte.[1]", 10)); } - /** - * @see DATAMONGO-784 - */ - @Test + @Test // DATAMONGO-784 public void shouldRenderNeCorrectly() { ProjectionOperation operation = Aggregation.project().and("field").ne(10).as("ne10"); @@ -533,10 +443,7 @@ public class ProjectionOperationUnitTests { isBsonObject().containing("$project.ne10.$ne.[0]", "$field").containing("$project.ne10.$ne.[1]", 10)); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetEquals() { DBObject agg = project("A", "B").and("A").equalsArrays("B").as("sameElements") @@ -545,10 +452,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, sameElements: { $setEquals: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetEqualsAggregationExpresssion() { DBObject agg = project("A", "B").and(SetOperators.arrayAsSet("A").isEqualTo("B")).as("sameElements") @@ -557,10 +461,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, sameElements: { $setEquals: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetIntersection() { DBObject agg = project("A", "B").and("A").intersectsArrays("B").as("commonToBoth") @@ -570,10 +471,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { A: 1, B: 1, commonToBoth: { $setIntersection: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetIntersectionAggregationExpresssion() { DBObject agg = project("A", "B").and(SetOperators.arrayAsSet("A").intersects("B")).as("commonToBoth") @@ -583,10 +481,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { A: 1, B: 1, commonToBoth: { $setIntersection: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetUnion() { DBObject agg = project("A", "B").and("A").unionArrays("B").as("allValues").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -594,10 +489,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, allValues: { $setUnion: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetUnionAggregationExpresssion() { DBObject agg = project("A", "B").and(SetOperators.arrayAsSet("A").union("B")).as("allValues") @@ -606,10 +498,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, allValues: { $setUnion: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetDifference() { DBObject agg = project("A", "B").and("B").differenceToArray("A").as("inBOnly") @@ -618,10 +507,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, inBOnly: { $setDifference: [ \"$B\", \"$A\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetDifferenceAggregationExpresssion() { DBObject agg = project("A", "B").and(SetOperators.arrayAsSet("B").differenceTo("A")).as("inBOnly") @@ -630,10 +516,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, inBOnly: { $setDifference: [ \"$B\", \"$A\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetIsSubset() { DBObject agg = project("A", "B").and("A").subsetOfArray("B").as("aIsSubsetOfB") @@ -642,10 +525,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, aIsSubsetOfB: { $setIsSubset: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSetIsSubsetAggregationExpresssion() { DBObject agg = project("A", "B").and(SetOperators.arrayAsSet("A").isSubsetOf("B")).as("aIsSubsetOfB") @@ -654,10 +534,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { A: 1, B: 1, aIsSubsetOfB: { $setIsSubset: [ \"$A\", \"$B\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAnyElementTrue() { DBObject agg = project("responses").and("responses").anyElementInArrayTrue().as("isAnyTrue") @@ -666,10 +543,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { responses: 1, isAnyTrue: { $anyElementTrue: [ \"$responses\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAnyElementTrueAggregationExpresssion() { DBObject agg = project("responses").and(SetOperators.arrayAsSet("responses").anyElementTrue()).as("isAnyTrue") @@ -678,10 +552,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { responses: 1, isAnyTrue: { $anyElementTrue: [ \"$responses\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAllElementsTrue() { DBObject agg = project("responses").and("responses").allElementsInArrayTrue().as("isAllTrue") @@ -691,10 +562,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { responses: 1, isAllTrue: { $allElementsTrue: [ \"$responses\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAllElementsTrueAggregationExpresssion() { DBObject agg = project("responses").and(SetOperators.arrayAsSet("responses").allElementsTrue()).as("isAllTrue") @@ -704,10 +572,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { responses: 1, isAllTrue: { $allElementsTrue: [ \"$responses\" ] }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAbs() { DBObject agg = project().and("anyNumber").absoluteValue().as("absoluteValue") @@ -716,10 +581,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { absoluteValue : { $abs: \"$anyNumber\" }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAbsAggregationExpresssion() { DBObject agg = project() @@ -730,10 +592,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { delta: { $abs: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAddAggregationExpresssion() { DBObject agg = project().and(ArithmeticOperators.valueOf("price").add("fee")).as("total") @@ -742,10 +601,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse(" { $project: { total: { $add: [ \"$price\", \"$fee\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderCeil() { DBObject agg = project().and("anyNumber").ceil().as("ceilValue").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -753,10 +609,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { ceilValue : { $ceil: \"$anyNumber\" }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderCeilAggregationExpresssion() { DBObject agg = project().and( @@ -766,10 +619,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { delta: { $ceil: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDivide() { DBObject agg = project().and("value") @@ -780,10 +630,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { result: { $divide: [ \"$value\", { $subtract: [ \"$start\", \"$end\" ] }] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDivideAggregationExpresssion() { DBObject agg = project() @@ -795,10 +642,7 @@ public class ProjectionOperationUnitTests { .parse("{ $project: { result: { $divide: [ \"$anyNumber\", { $subtract: [ \"$start\", \"$end\" ] }] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderExp() { DBObject agg = project().and("value").exp().as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -806,10 +650,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $exp: \"$value\" } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderExpAggregationExpresssion() { DBObject agg = project() @@ -820,10 +661,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $exp: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderFloor() { DBObject agg = project().and("value").floor().as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -831,10 +669,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $floor: \"$value\" } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderFloorAggregationExpresssion() { DBObject agg = project().and( @@ -844,10 +679,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $floor: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLn() { DBObject agg = project().and("value").ln().as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -855,10 +687,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $ln: \"$value\"} }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLnAggregationExpresssion() { DBObject agg = project() @@ -868,10 +697,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $ln: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLog() { DBObject agg = project().and("value").log(2).as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -879,10 +705,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $log: [ \"$value\", 2] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLogAggregationExpresssion() { DBObject agg = project().and( @@ -892,10 +715,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $log: [ { $subtract: [ \"$start\", \"$end\" ] }, 2] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLog10() { DBObject agg = project().and("value").log10().as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -903,10 +723,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $log10: \"$value\" } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLog10AggregationExpresssion() { DBObject agg = project().and( @@ -916,10 +733,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $log10: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMod() { DBObject agg = project().and("value").mod(AggregationFunctionExpressions.SUBTRACT.of(field("start"), field("end"))) @@ -929,10 +743,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { result: { $mod: [\"$value\", { $subtract: [ \"$start\", \"$end\" ] }] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderModAggregationExpresssion() { DBObject agg = project().and( @@ -942,10 +753,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $mod: [{ $subtract: [ \"$start\", \"$end\" ] }, 2] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMultiply() { DBObject agg = project().and("value") @@ -956,10 +764,7 @@ public class ProjectionOperationUnitTests { JSON.parse("{ $project: { result: { $multiply: [\"$value\", { $subtract: [ \"$start\", \"$end\" ] }] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMultiplyAggregationExpresssion() { DBObject agg = project() @@ -971,10 +776,7 @@ public class ProjectionOperationUnitTests { "{ $project: { result: { $multiply: [{ $subtract: [ \"$start\", \"$end\" ] }, 2, \"$refToAnotherNumber\"] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderPow() { DBObject agg = project().and("value").pow(2).as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -982,10 +784,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $pow: [\"$value\", 2] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderPowAggregationExpresssion() { DBObject agg = project().and( @@ -995,10 +794,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $pow: [{ $subtract: [ \"$start\", \"$end\" ] }, 2] } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSqrt() { DBObject agg = project().and("value").sqrt().as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1006,10 +802,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $sqrt: \"$value\" } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSqrtAggregationExpresssion() { DBObject agg = project().and( @@ -1019,10 +812,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $sqrt: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSubtract() { DBObject agg = project().and("numericField").minus(AggregationFunctionExpressions.SIZE.of(field("someArray"))) @@ -1032,10 +822,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { result: { $subtract: [ \"$numericField\", { $size : [\"$someArray\"]}] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSubtractAggregationExpresssion() { DBObject agg = project() @@ -1047,10 +834,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { result: { $subtract: [ \"$numericField\", { $size : [\"$someArray\"]}] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderTrunc() { DBObject agg = project().and("value").trunc().as("result").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1058,10 +842,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result : { $trunc: \"$value\" }}}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderTruncAggregationExpresssion() { DBObject agg = project().and( @@ -1071,10 +852,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $trunc: { $subtract: [ \"$start\", \"$end\" ] } } }}"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderConcat() { DBObject agg = project().and("item").concat(" - ", field("description")).as("itemDescription") @@ -1085,10 +863,7 @@ public class ProjectionOperationUnitTests { } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderConcatAggregationExpression() { DBObject agg = project().and(StringOperators.valueOf("item").concat(" - ").concatValueOf("description")) @@ -1099,10 +874,7 @@ public class ProjectionOperationUnitTests { } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSubstr() { DBObject agg = project().and("quarter").substring(0, 2).as("yearSubstring").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1110,10 +882,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { yearSubstring: { $substr: [ \"$quarter\", 0, 2 ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSubstrAggregationExpression() { DBObject agg = project().and(StringOperators.valueOf("quarter").substring(0, 2)).as("yearSubstring") @@ -1122,10 +891,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { yearSubstring: { $substr: [ \"$quarter\", 0, 2 ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderToLower() { DBObject agg = project().and("item").toLower().as("item").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1133,10 +899,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { item: { $toLower: \"$item\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderToLowerAggregationExpression() { DBObject agg = project().and(StringOperators.valueOf("item").toLower()).as("item") @@ -1145,10 +908,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { item: { $toLower: \"$item\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderToUpper() { DBObject agg = project().and("item").toUpper().as("item").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1156,10 +916,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { item: { $toUpper: \"$item\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderToUpperAggregationExpression() { DBObject agg = project().and(StringOperators.valueOf("item").toUpper()).as("item") @@ -1168,10 +925,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { item: { $toUpper: \"$item\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderStrCaseCmp() { DBObject agg = project().and("quarter").strCaseCmp("13q4").as("comparisonResult") @@ -1180,10 +934,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { comparisonResult: { $strcasecmp: [ \"$quarter\", \"13q4\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderStrCaseCmpAggregationExpression() { DBObject agg = project().and(StringOperators.valueOf("quarter").strCaseCmp("13q4")).as("comparisonResult") @@ -1192,10 +943,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { comparisonResult: { $strcasecmp: [ \"$quarter\", \"13q4\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderArrayElementAt() { DBObject agg = project().and("favorites").arrayElementAt(0).as("first").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1203,10 +951,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { first: { $arrayElemAt: [ \"$favorites\", 0 ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderArrayElementAtAggregationExpression() { DBObject agg = project().and(ArrayOperators.arrayOf("favorites").elementAt(0)).as("first") @@ -1215,10 +960,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { first: { $arrayElemAt: [ \"$favorites\", 0 ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderConcatArrays() { DBObject agg = project().and("instock").concatArrays("ordered").as("items").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1226,10 +968,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { items: { $concatArrays: [ \"$instock\", \"$ordered\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderConcatArraysAggregationExpression() { DBObject agg = project().and(ArrayOperators.arrayOf("instock").concat("ordered")).as("items") @@ -1238,10 +977,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { items: { $concatArrays: [ \"$instock\", \"$ordered\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderIsArray() { DBObject agg = project().and("instock").isArray().as("isAnArray").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1249,10 +985,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { isAnArray: { $isArray: \"$instock\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderIsArrayAggregationExpression() { DBObject agg = project().and(ArrayOperators.arrayOf("instock").isArray()).as("isAnArray") @@ -1261,10 +994,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { isAnArray: { $isArray: \"$instock\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSizeAggregationExpression() { DBObject agg = project().and(ArrayOperators.arrayOf("instock").length()).as("arraySize") @@ -1273,10 +1003,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { arraySize: { $size: \"$instock\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSliceAggregationExpression() { DBObject agg = project().and(ArrayOperators.arrayOf("favorites").slice().itemCount(3)).as("threeFavorites") @@ -1285,10 +1012,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { threeFavorites: { $slice: [ \"$favorites\", 3 ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSliceWithPositionAggregationExpression() { DBObject agg = project().and(ArrayOperators.arrayOf("favorites").slice().offset(2).itemCount(3)) @@ -1297,10 +1021,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { threeFavorites: { $slice: [ \"$favorites\", 2, 3 ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLiteral() { DBObject agg = project().and("$1").asLiteral().as("literalOnly").toDBObject(Aggregation.DEFAULT_CONTEXT); @@ -1308,10 +1029,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { literalOnly: { $literal: \"$1\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLiteralAggregationExpression() { DBObject agg = project().and(LiteralOperators.valueOf("$1").asLiteral()).as("literalOnly") @@ -1320,10 +1038,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { literalOnly: { $literal: \"$1\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDayOfYearAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").dayOfYear()).as("dayOfYear") @@ -1332,10 +1047,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { dayOfYear: { $dayOfYear: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDayOfMonthAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").dayOfMonth()).as("day") @@ -1344,10 +1056,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { day: { $dayOfMonth: \"$date\" }} }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDayOfWeekAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").dayOfWeek()).as("dayOfWeek") @@ -1356,10 +1065,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { dayOfWeek: { $dayOfWeek: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderYearAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").year()).as("year") @@ -1368,10 +1074,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { year: { $year: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMonthAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").month()).as("month") @@ -1380,10 +1083,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { month: { $month: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderWeekAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").week()).as("week") @@ -1392,10 +1092,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { week: { $week: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderHourAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").hour()).as("hour") @@ -1404,10 +1101,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { hour: { $hour: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMinuteAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").minute()).as("minute") @@ -1416,10 +1110,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { minute: { $minute: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSecondAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").second()).as("second") @@ -1428,10 +1119,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { second: { $second: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMillisecondAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").millisecond()).as("msec") @@ -1440,10 +1128,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { msec: { $millisecond: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDateToString() { DBObject agg = project().and("date").dateAsFormattedString("%H:%M:%S:%L").as("time") @@ -1453,10 +1138,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { time: { $dateToString: { format: \"%H:%M:%S:%L\", date: \"$date\" } } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderDateToStringAggregationExpression() { DBObject agg = project().and(DateOperators.dateOf("date").toString("%H:%M:%S:%L")).as("time") @@ -1466,10 +1148,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { time: { $dateToString: { format: \"%H:%M:%S:%L\", date: \"$date\" } } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSumAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("quizzes").sum()).as("quizTotal") @@ -1478,10 +1157,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { quizTotal: { $sum: \"$quizzes\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderSumWithMultipleArgsAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("final").sum().and("midterm")).as("examTotal") @@ -1490,10 +1166,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { examTotal: { $sum: [ \"$final\", \"$midterm\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAvgAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("quizzes").avg()).as("quizAvg") @@ -1502,10 +1175,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { quizAvg: { $avg: \"$quizzes\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderAvgWithMultipleArgsAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("final").avg().and("midterm")).as("examAvg") @@ -1514,10 +1184,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { examAvg: { $avg: [ \"$final\", \"$midterm\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMaxAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("quizzes").max()).as("quizMax") @@ -1526,10 +1193,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { quizMax: { $max: \"$quizzes\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMaxWithMultipleArgsAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("final").max().and("midterm")).as("examMax") @@ -1538,10 +1202,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { examMax: { $max: [ \"$final\", \"$midterm\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMinAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("quizzes").min()).as("quizMin") @@ -1550,10 +1211,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { quizMin: { $min: \"$quizzes\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderMinWithMultipleArgsAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("final").min().and("midterm")).as("examMin") @@ -1562,10 +1220,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { examMin: { $min: [ \"$final\", \"$midterm\" ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderStdDevPopAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("scores").stdDevPop()).as("stdDev") @@ -1574,10 +1229,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { stdDev: { $stdDevPop: \"$scores\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderStdDevSampAggregationExpression() { DBObject agg = project().and(ArithmeticOperators.valueOf("scores").stdDevSamp()).as("stdDev") @@ -1586,10 +1238,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { stdDev: { $stdDevSamp: \"$scores\"} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderCmpAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").compareToValue(250)).as("cmp250") @@ -1598,10 +1247,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { cmp250: { $cmp: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderEqAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").equalToValue(250)).as("eq250") @@ -1610,10 +1256,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { eq250: { $eq: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderGtAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").greaterThanValue(250)).as("gt250") @@ -1622,10 +1265,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { gt250: { $gt: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderGteAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").greaterThanEqualToValue(250)).as("gte250") @@ -1634,10 +1274,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { gte250: { $gte: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLtAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").lessThanValue(250)).as("lt250") @@ -1646,10 +1283,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { lt250: { $lt: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLteAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").lessThanEqualToValue(250)).as("lte250") @@ -1658,10 +1292,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { lte250: { $lte: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderNeAggregationExpression() { DBObject agg = project().and(ComparisonOperators.valueOf("qty").notEqualToValue(250)).as("ne250") @@ -1670,10 +1301,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { ne250: { $ne: [\"$qty\", 250]} } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLogicAndAggregationExpression() { DBObject agg = project() @@ -1685,10 +1313,7 @@ public class ProjectionOperationUnitTests { JSON.parse("{ $project: { result: { $and: [ { $gt: [ \"$qty\", 100 ] }, { $lt: [ \"$qty\", 250 ] } ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderLogicOrAggregationExpression() { DBObject agg = project() @@ -1700,10 +1325,7 @@ public class ProjectionOperationUnitTests { JSON.parse("{ $project: { result: { $or: [ { $gt: [ \"$qty\", 250 ] }, { $lt: [ \"$qty\", 200 ] } ] } } }"))); } - /** - * @see DATAMONGO-1536 - */ - @Test + @Test // DATAMONGO-1536 public void shouldRenderNotAggregationExpression() { DBObject agg = project().and(BooleanOperators.not(ComparisonOperators.valueOf("qty").greaterThanValue(250))) @@ -1712,10 +1334,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $not: [ { $gt: [ \"$qty\", 250 ] } ] } } }"))); } - /** - * @see DATAMONGO-1540 - */ - @Test + @Test // DATAMONGO-1540 public void shouldRenderMapAggregationExpression() { DBObject agg = Aggregation.project() @@ -1727,10 +1346,7 @@ public class ProjectionOperationUnitTests { "{ $project:{ adjustedGrades:{ $map: { input: \"$quizzes\", as: \"grade\",in: { $add: [ \"$$grade\", 2 ] }}}}}"))); } - /** - * @see DATAMONGO-1540 - */ - @Test + @Test // DATAMONGO-1540 public void shouldRenderMapAggregationExpressionOnExpression() { DBObject agg = Aggregation.project() @@ -1742,10 +1358,7 @@ public class ProjectionOperationUnitTests { "{ $project:{ adjustedGrades:{ $map: { input: { $size : [\"foo\"]}, as: \"grade\",in: { $add: [ \"$$grade\", 2 ] }}}}}"))); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void shouldRenderIfNullConditionAggregationExpression() { DBObject agg = project().and( @@ -1756,10 +1369,7 @@ public class ProjectionOperationUnitTests { "{ $project: { result: { $ifNull: [ { $arrayElemAt: [\"$array\", 1] }, \"a more sophisticated value\" ] } } }"))); } - /** - * @see DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-1542 public void shouldRenderIfNullValueAggregationExpression() { DBObject agg = project() @@ -1770,10 +1380,7 @@ public class ProjectionOperationUnitTests { is(JSON.parse("{ $project: { result: { $ifNull: [ \"$field\", { $arrayElemAt: [\"$array\", 1] } ] } } }"))); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void fieldReplacementIfNullShouldRenderCorrectly() { DBObject agg = project().and(ConditionalOperators.ifNull("optional").thenValueOf("$never-null")).as("result") @@ -1782,10 +1389,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, is(JSON.parse("{ $project: { result: { $ifNull: [ \"$optional\", \"$never-null\" ] } } }"))); } - /** - * @see DATAMONGO-1538 - */ - @Test + @Test // DATAMONGO-1538 public void shouldRenderLetExpressionCorrectly() { DBObject agg = Aggregation.project() @@ -1808,10 +1412,7 @@ public class ProjectionOperationUnitTests { "}}}}"))); } - /** - * @see DATAMONGO-1538 - */ - @Test + @Test // DATAMONGO-1538 public void shouldRenderLetExpressionCorrectlyWhenUsingLetOnProjectionBuilder() { ExpressionVariable var1 = newVariable("total") @@ -1835,10 +1436,7 @@ public class ProjectionOperationUnitTests { "}}}}"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIndexOfBytesCorrectly() { DBObject agg = project().and(StringOperators.valueOf("item").indexOf("foo")).as("byteLocation") @@ -1848,10 +1446,7 @@ public class ProjectionOperationUnitTests { Matchers.is(JSON.parse("{ $project: { byteLocation: { $indexOfBytes: [ \"$item\", \"foo\" ] } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIndexOfBytesWithRangeCorrectly() { DBObject agg = project().and(StringOperators.valueOf("item").indexOf("foo").within(new Range(5L, 9L))) @@ -1861,10 +1456,7 @@ public class ProjectionOperationUnitTests { .containing("$project.byteLocation.$indexOfBytes.[3]", 9L)); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIndexOfCPCorrectly() { DBObject agg = project().and(StringOperators.valueOf("item").indexOfCP("foo")).as("cpLocation") @@ -1873,10 +1465,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project: { cpLocation: { $indexOfCP: [ \"$item\", \"foo\" ] } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIndexOfCPWithRangeCorrectly() { DBObject agg = project().and(StringOperators.valueOf("item").indexOfCP("foo").within(new Range(5L, 9L))) @@ -1886,10 +1475,7 @@ public class ProjectionOperationUnitTests { .containing("$project.cpLocation.$indexOfCP.[3]", 9L)); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderSplitCorrectly() { DBObject agg = project().and(StringOperators.valueOf("city").split(", ")).as("city_state") @@ -1898,10 +1484,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { city_state : { $split: [\"$city\", \", \"] }} }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderStrLenBytesCorrectly() { DBObject agg = project().and(StringOperators.valueOf("name").length()).as("length") @@ -1910,10 +1493,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { \"length\": { $strLenBytes: \"$name\" } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderStrLenCPCorrectly() { DBObject agg = project().and(StringOperators.valueOf("name").lengthCP()).as("length") @@ -1922,10 +1502,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { \"length\": { $strLenCP: \"$name\" } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderSubstrCPCorrectly() { DBObject agg = project().and(StringOperators.valueOf("quarter").substringCP(0, 2)).as("yearSubstring") @@ -1934,10 +1511,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { yearSubstring: { $substrCP: [ \"$quarter\", 0, 2 ] } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIndexOfArrayCorrectly() { DBObject agg = project().and(ArrayOperators.arrayOf("items").indexOf(2)).as("index") @@ -1946,10 +1520,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { index: { $indexOfArray: [ \"$items\", 2 ] } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderRangeCorrectly() { DBObject agg = project().and(ArrayOperators.RangeOperator.rangeStartingAt(0L).to("distance").withStepSize(25L)) @@ -1959,10 +1530,7 @@ public class ProjectionOperationUnitTests { .containing("$project.rest_stops.$range.[1]", "$distance").containing("$project.rest_stops.$range.[2]", 25L)); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderReverseArrayCorrectly() { DBObject agg = project().and(ArrayOperators.arrayOf("favorites").reverse()).as("reverseFavorites") @@ -1971,10 +1539,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { reverseFavorites: { $reverseArray: \"$favorites\" } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderReduceWithSimpleObjectCorrectly() { DBObject agg = project() @@ -1986,10 +1551,7 @@ public class ProjectionOperationUnitTests { "{ $project : { \"results\": { $reduce: { input: \"$probabilityArr\", initialValue: 1, in: { $multiply: [ \"$$value\", \"$$this\" ] } } } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderReduceWithComplexObjectCorrectly() { PropertyExpression sum = PropertyExpression.property("sum").definedAs( @@ -2006,10 +1568,7 @@ public class ProjectionOperationUnitTests { "{ $project : { \"results\": { $reduce: { input: \"$probabilityArr\", initialValue: { \"sum\" : 5 , \"product\" : 2} , in: { \"sum\": { $add : [\"$$value.sum\", \"$$this\"] }, \"product\": { $multiply: [ \"$$value.product\", \"$$this\" ] } } } } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderZipCorrectly() { AggregationExpression elemAt0 = ArrayOperators.arrayOf("matrix").elementAt(0); @@ -2024,10 +1583,7 @@ public class ProjectionOperationUnitTests { "{ $project : { transposed: { $zip: { inputs: [ { $arrayElemAt: [ \"$matrix\", 0 ] }, { $arrayElemAt: [ \"$matrix\", 1 ] }, { $arrayElemAt: [ \"$matrix\", 2 ] } ], useLongestLength : true, defaults: [1,2] } } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderInCorrectly() { DBObject agg = project().and(ArrayOperators.arrayOf("in_stock").containsValue("bananas")).as("has_bananas") @@ -2037,10 +1593,7 @@ public class ProjectionOperationUnitTests { Matchers.is(JSON.parse("{ $project : { has_bananas : { $in : [\"bananas\", \"$in_stock\" ] } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIsoDayOfWeekCorrectly() { DBObject agg = project().and(DateOperators.dateOf("birthday").isoDayOfWeek()).as("dayOfWeek") @@ -2049,10 +1602,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { dayOfWeek: { $isoDayOfWeek: \"$birthday\" } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIsoWeekCorrectly() { DBObject agg = project().and(DateOperators.dateOf("date").isoWeek()).as("weekNumber") @@ -2061,10 +1611,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { weekNumber: { $isoWeek: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderIsoWeekYearCorrectly() { DBObject agg = project().and(DateOperators.dateOf("date").isoWeekYear()).as("yearNumber") @@ -2073,10 +1620,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { yearNumber: { $isoWeekYear: \"$date\" } } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderSwitchCorrectly() { String expected = "$switch:\n" + // @@ -2118,10 +1662,7 @@ public class ProjectionOperationUnitTests { assertThat(agg, Matchers.is(JSON.parse("{ $project : { summary: {" + expected + "} } }"))); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldTypeCorrectly() { DBObject agg = project().and(DataTypeOperators.Type.typeOf("a")).as("a").toDBObject(Aggregation.DEFAULT_CONTEXT); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperationUnitTests.java index 49223ccb7..90376d5dd 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperationUnitTests.java @@ -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. @@ -32,26 +32,17 @@ import com.mongodb.util.JSON; */ public class ReplaceRootOperationUnitTests { - /** - * @see DATAMONGO-1550 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1550 public void rejectsNullField() { new ReplaceRootOperation((Field) null); } - /** - * @see DATAMONGO-1550 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1550 public void rejectsNullExpression() { new ReplaceRootOperation((AggregationExpression) null); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void shouldRenderCorrectly() { ReplaceRootOperation operation = ReplaceRootDocumentOperation.builder() @@ -61,10 +52,7 @@ public class ReplaceRootOperationUnitTests { assertThat(dbObject, is(JSON.parse("{ $replaceRoot : { newRoot: { hello: \"world\" } } }"))); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void shouldRenderExpressionCorrectly() { ReplaceRootOperation operation = new ReplaceRootOperation(VariableOperators // @@ -78,10 +66,7 @@ public class ReplaceRootOperationUnitTests { + "$map : { input : \"$array\" , as : \"element\" , in : { $multiply : [ \"$$element\" , 10]} } " + "} } }"))); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void shouldComposeDocument() { ReplaceRootOperation operation = ReplaceRootDocumentOperation.builder().withDocument() // @@ -94,10 +79,7 @@ public class ReplaceRootOperationUnitTests { .parse("{ $replaceRoot : { newRoot: { key: \"value\", multiply: { $multiply : [ \"$$element\" , 10]} } } }"))); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void shouldComposeSubDocument() { DBObject partialReplacement = new BasicDBObject("key", "override").append("key2", "value2"); @@ -111,10 +93,7 @@ public class ReplaceRootOperationUnitTests { assertThat(dbObject, is(JSON.parse("{ $replaceRoot : { newRoot: { key: \"override\", key2: \"value2\"} } } }"))); } - /** - * @see DATAMONGO-1550 - */ - @Test + @Test // DATAMONGO-1550 public void shouldNotExposeFields() { ReplaceRootOperation operation = new ReplaceRootOperation(Fields.field("field")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerIntegrationTests.java index a5260b712..3710b6899 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerIntegrationTests.java @@ -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. @@ -37,7 +37,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * Integration tests for {@link SpelExpressionTransformer}. * - * @see DATAMONGO-774 * @author Thomas Darimont */ @RunWith(SpringJUnit4ClassRunner.class) @@ -57,7 +56,7 @@ public class SpelExpressionTransformerIntegrationTests { this.dbRefResolver = new DefaultDbRefResolver(mongoDbFactory); } - @Test + @Test // DATAMONGO-774 public void shouldConvertCompoundExpressionToPropertyPath() { MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, new MongoMappingContext()); @@ -67,7 +66,7 @@ public class SpelExpressionTransformerIntegrationTests { is("$item.primitiveIntValue")); } - @Test + @Test // DATAMONGO-774 public void shouldThrowExceptionIfNestedPropertyCannotBeFound() { exception.expect(MappingException.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerUnitTests.java index 013d6189e..7f7423a99 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/SpelExpressionTransformerUnitTests.java @@ -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. @@ -26,7 +26,6 @@ import org.springframework.data.mongodb.core.Person; /** * Unit tests for {@link SpelExpressionTransformer}. * - * @see DATAMONGO-774 * @author Thomas Darimont * @author Oliver Gierke * @author Christoph Strobl @@ -48,7 +47,7 @@ public class SpelExpressionTransformerUnitTests { this.data.item.primitiveIntValue = 21; } - @Test + @Test // DATAMONGO-774 public void shouldRenderConstantExpression() { assertThat(transform("1"), is("1")); @@ -58,7 +57,7 @@ public class SpelExpressionTransformerUnitTests { assertThat(transform("null"), is(nullValue())); } - @Test + @Test // DATAMONGO-774 public void shouldSupportKnownOperands() { assertThat(transform("a + b"), is("{ \"$add\" : [ \"$a\" , \"$b\"]}")); @@ -68,45 +67,45 @@ public class SpelExpressionTransformerUnitTests { assertThat(transform("a % b"), is("{ \"$mod\" : [ \"$a\" , \"$b\"]}")); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-774 public void shouldThrowExceptionOnUnknownOperand() { transform("a++"); } - @Test + @Test // DATAMONGO-774 public void shouldRenderSumExpression() { assertThat(transform("a + 1"), is("{ \"$add\" : [ \"$a\" , 1]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderFormula() { assertThat(transform("(netPrice + surCharge) * taxrate + 42"), is( "{ \"$add\" : [ { \"$multiply\" : [ { \"$add\" : [ \"$netPrice\" , \"$surCharge\"]} , \"$taxrate\"]} , 42]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderFormulaInCurlyBrackets() { assertThat(transform("{(netPrice + surCharge) * taxrate + 42}"), is( "{ \"$add\" : [ { \"$multiply\" : [ { \"$add\" : [ \"$netPrice\" , \"$surCharge\"]} , \"$taxrate\"]} , 42]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderFieldReference() { assertThat(transform("foo"), is("$foo")); assertThat(transform("$foo"), is("$foo")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderNestedFieldReference() { assertThat(transform("foo.bar"), is("$foo.bar")); assertThat(transform("$foo.bar"), is("$foo.bar")); } - @Test + @Test // DATAMONGO-774 @Ignore public void shouldRenderNestedIndexedFieldReference() { @@ -114,46 +113,46 @@ public class SpelExpressionTransformerUnitTests { assertThat(transform("foo[3].bar"), is("$foo[3].bar")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderConsecutiveOperation() { assertThat(transform("1 + 1 + 1"), is("{ \"$add\" : [ 1 , 1 , 1]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderComplexExpression0() { assertThat(transform("-(1 + q)"), is("{ \"$multiply\" : [ -1 , { \"$add\" : [ 1 , \"$q\"]}]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderComplexExpression1() { assertThat(transform("1 + (q + 1) / (q - 1)"), is("{ \"$add\" : [ 1 , { \"$divide\" : [ { \"$add\" : [ \"$q\" , 1]} , { \"$subtract\" : [ \"$q\" , 1]}]}]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderComplexExpression2() { assertThat(transform("(q + 1 + 4 - 5) / (q + 1 + 3 + 4)"), is( "{ \"$divide\" : [ { \"$subtract\" : [ { \"$add\" : [ \"$q\" , 1 , 4]} , 5]} , { \"$add\" : [ \"$q\" , 1 , 3 , 4]}]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderBinaryExpressionWithMixedSignsCorrectly() { assertThat(transform("-4 + 1"), is("{ \"$add\" : [ -4 , 1]}")); assertThat(transform("1 + -4"), is("{ \"$add\" : [ 1 , -4]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderConsecutiveOperationsInComplexExpression() { assertThat(transform("1 + 1 + (1 + 1 + 1) / q"), is("{ \"$add\" : [ 1 , 1 , { \"$divide\" : [ { \"$add\" : [ 1 , 1 , 1]} , \"$q\"]}]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderParameterExpressionResults() { assertThat(transform("[0] + [1] + [2]", 1, 2, 3), is("{ \"$add\" : [ 1 , 2 , 3]}")); } @@ -165,7 +164,7 @@ public class SpelExpressionTransformerUnitTests { is("{ \"$add\" : [ 42 , 1.2345 , 23]}")); } - @Test + @Test // DATAMONGO-774 public void shouldRenderNestedParameterExpressionResultsInNestedExpressions() { assertThat( @@ -173,10 +172,7 @@ public class SpelExpressionTransformerUnitTests { is("{ \"$multiply\" : [ { \"$add\" : [ 1 , 42 , 1.2345]} , 23]}")); } - /** - * @see DATAMONGO-840 - */ - @Test + @Test // DATAMONGO-840 public void shouldRenderCompoundExpressionsWithIndexerAndFieldReference() { Person person = new Person(); @@ -184,825 +180,522 @@ public class SpelExpressionTransformerUnitTests { assertThat(transform("[0].age + a.c", person), is("{ \"$add\" : [ 10 , \"$a.c\"]}")); } - /** - * @see DATAMONGO-840 - */ - @Test + @Test // DATAMONGO-840 public void shouldRenderCompoundExpressionsWithOnlyFieldReferences() { assertThat(transform("a.b + a.c"), is("{ \"$add\" : [ \"$a.b\" , \"$a.c\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeAnd() { assertThat(transform("and(a, b)"), is("{ \"$and\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeOr() { assertThat(transform("or(a, b)"), is("{ \"$or\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeNot() { assertThat(transform("not(a)"), is("{ \"$not\" : [ \"$a\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSetEquals() { assertThat(transform("setEquals(a, b)"), is("{ \"$setEquals\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSetEqualsForArrays() { assertThat(transform("setEquals(new int[]{1,2,3}, new int[]{4,5,6})"), is("{ \"$setEquals\" : [ [ 1 , 2 , 3] , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSetEqualsMixedArrays() { assertThat(transform("setEquals(a, new int[]{4,5,6})"), is("{ \"$setEquals\" : [ \"$a\" , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceSetIntersection() { assertThat(transform("setIntersection(a, new int[]{4,5,6})"), is("{ \"$setIntersection\" : [ \"$a\" , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceSetUnion() { assertThat(transform("setUnion(a, new int[]{4,5,6})"), is("{ \"$setUnion\" : [ \"$a\" , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceSeDifference() { assertThat(transform("setDifference(a, new int[]{4,5,6})"), is("{ \"$setDifference\" : [ \"$a\" , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceSetIsSubset() { assertThat(transform("setIsSubset(a, new int[]{4,5,6})"), is("{ \"$setIsSubset\" : [ \"$a\" , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceAnyElementTrue() { assertThat(transform("anyElementTrue(a)"), is("{ \"$anyElementTrue\" : [ \"$a\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceAllElementsTrue() { assertThat(transform("allElementsTrue(a, new int[]{4,5,6})"), is("{ \"$allElementsTrue\" : [ \"$a\" , [ 4 , 5 , 6]]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceCmp() { assertThat(transform("cmp(a, 250)"), is("{ \"$cmp\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceEq() { assertThat(transform("eq(a, 250)"), is("{ \"$eq\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceGt() { assertThat(transform("gt(a, 250)"), is("{ \"$gt\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceGte() { assertThat(transform("gte(a, 250)"), is("{ \"$gte\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLt() { assertThat(transform("lt(a, 250)"), is("{ \"$lt\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLte() { assertThat(transform("lte(a, 250)"), is("{ \"$lte\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNe() { assertThat(transform("ne(a, 250)"), is("{ \"$ne\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceAbs() { assertThat(transform("abs(1)"), is("{ \"$abs\" : 1}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceAdd() { assertThat(transform("add(a, 250)"), is("{ \"$add\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceCeil() { assertThat(transform("ceil(7.8)"), is("{ \"$ceil\" : 7.8}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceDivide() { assertThat(transform("divide(a, 250)"), is("{ \"$divide\" : [ \"$a\" , 250]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceExp() { assertThat(transform("exp(2)"), is("{ \"$exp\" : 2}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceFloor() { assertThat(transform("floor(2)"), is("{ \"$floor\" : 2}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLn() { assertThat(transform("ln(2)"), is("{ \"$ln\" : 2}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLog() { assertThat(transform("log(100, 10)"), is("{ \"$log\" : [ 100 , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLog10() { assertThat(transform("log10(100)"), is("{ \"$log10\" : 100}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeMod() { assertThat(transform("mod(a, b)"), is("{ \"$mod\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeMultiply() { assertThat(transform("multiply(a, b)"), is("{ \"$multiply\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodePow() { assertThat(transform("pow(a, 2)"), is("{ \"$pow\" : [ \"$a\" , 2]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceSqrt() { assertThat(transform("sqrt(2)"), is("{ \"$sqrt\" : 2}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSubtract() { assertThat(transform("subtract(a, b)"), is("{ \"$subtract\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceTrunc() { assertThat(transform("trunc(2.1)"), is("{ \"$trunc\" : 2.1}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeConcat() { assertThat(transform("concat(a, b, 'c')"), is("{ \"$concat\" : [ \"$a\" , \"$b\" , \"c\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSubstrc() { assertThat(transform("substr(a, 0, 1)"), is("{ \"$substr\" : [ \"$a\" , 0 , 1]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceToLower() { assertThat(transform("toLower(a)"), is("{ \"$toLower\" : \"$a\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceToUpper() { assertThat(transform("toUpper(a)"), is("{ \"$toUpper\" : \"$a\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeStrCaseCmp() { assertThat(transform("strcasecmp(a, b)"), is("{ \"$strcasecmp\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceMeta() { assertThat(transform("meta('textScore')"), is("{ \"$meta\" : \"textScore\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeArrayElemAt() { assertThat(transform("arrayElemAt(a, 10)"), is("{ \"$arrayElemAt\" : [ \"$a\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeConcatArrays() { assertThat(transform("concatArrays(a, b, c)"), is("{ \"$concatArrays\" : [ \"$a\" , \"$b\" , \"$c\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeFilter() { assertThat(transform("filter(a, 'num', '$$num' > 10)"), is("{ \"$filter\" : { \"input\" : \"$a\" , \"as\" : \"num\" , \"cond\" : { \"$gt\" : [ \"$$num\" , 10]}}}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceIsArray() { assertThat(transform("isArray(a)"), is("{ \"$isArray\" : \"$a\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceIsSize() { assertThat(transform("size(a)"), is("{ \"$size\" : \"$a\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSlice() { assertThat(transform("slice(a, 10)"), is("{ \"$slice\" : [ \"$a\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeMap() { assertThat(transform("map(quizzes, 'grade', '$$grade' + 2)"), is( "{ \"$map\" : { \"input\" : \"$quizzes\" , \"as\" : \"grade\" , \"in\" : { \"$add\" : [ \"$$grade\" , 2]}}}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeLet() { assertThat(transform("let({low:1, high:'$$low'}, gt('$$low', '$$high'))"), is( "{ \"$let\" : { \"vars\" : { \"low\" : 1 , \"high\" : \"$$low\"} , \"in\" : { \"$gt\" : [ \"$$low\" , \"$$high\"]}}}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLiteral() { assertThat(transform("literal($1)"), is("{ \"$literal\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceDayOfYear() { assertThat(transform("dayOfYear($1)"), is("{ \"$dayOfYear\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceDayOfMonth() { assertThat(transform("dayOfMonth($1)"), is("{ \"$dayOfMonth\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceDayOfWeek() { assertThat(transform("dayOfWeek($1)"), is("{ \"$dayOfWeek\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceYear() { assertThat(transform("year($1)"), is("{ \"$year\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceMonth() { assertThat(transform("month($1)"), is("{ \"$month\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceWeek() { assertThat(transform("week($1)"), is("{ \"$week\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceHour() { assertThat(transform("hour($1)"), is("{ \"$hour\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceMinute() { assertThat(transform("minute($1)"), is("{ \"$minute\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceSecond() { assertThat(transform("second($1)"), is("{ \"$second\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceMillisecond() { assertThat(transform("millisecond($1)"), is("{ \"$millisecond\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceDateToString() { assertThat(transform("dateToString('%Y-%m-%d', $date)"), is("{ \"$dateToString\" : { \"format\" : \"%Y-%m-%d\" , \"date\" : \"$date\"}}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceCond() { assertThat(transform("cond(qty > 250, 30, 20)"), is("{ \"$cond\" : { \"if\" : { \"$gt\" : [ \"$qty\" , 250]} , \"then\" : 30 , \"else\" : 20}}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeIfNull() { assertThat(transform("ifNull(a, 10)"), is("{ \"$ifNull\" : [ \"$a\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeSum() { assertThat(transform("sum(a, b)"), is("{ \"$sum\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeAvg() { assertThat(transform("avg(a, b)"), is("{ \"$avg\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceFirst() { assertThat(transform("first($1)"), is("{ \"$first\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceLast() { assertThat(transform("last($1)"), is("{ \"$last\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeMax() { assertThat(transform("max(a, b)"), is("{ \"$max\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeMin() { assertThat(transform("min(a, b)"), is("{ \"$min\" : [ \"$a\" , \"$b\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodePush() { assertThat(transform("push({'item':'$item', 'quantity':'$qty'})"), is("{ \"$push\" : { \"item\" : \"$item\" , \"quantity\" : \"$qty\"}}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceAddToSet() { assertThat(transform("addToSet($1)"), is("{ \"$addToSet\" : \"$1\"}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeStdDevPop() { assertThat(transform("stdDevPop(scores.score)"), is("{ \"$stdDevPop\" : [ \"$scores.score\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderMethodReferenceNodeStdDevSamp() { assertThat(transform("stdDevSamp(age)"), is("{ \"$stdDevSamp\" : [ \"$age\"]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeEq() { assertThat(transform("foo == 10"), is("{ \"$eq\" : [ \"$foo\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeNe() { assertThat(transform("foo != 10"), is("{ \"$ne\" : [ \"$foo\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeGt() { assertThat(transform("foo > 10"), is("{ \"$gt\" : [ \"$foo\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeGte() { assertThat(transform("foo >= 10"), is("{ \"$gte\" : [ \"$foo\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeLt() { assertThat(transform("foo < 10"), is("{ \"$lt\" : [ \"$foo\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeLte() { assertThat(transform("foo <= 10"), is("{ \"$lte\" : [ \"$foo\" , 10]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodePow() { assertThat(transform("foo^2"), is("{ \"$pow\" : [ \"$foo\" , 2]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeOr() { assertThat(transform("true || false"), is("{ \"$or\" : [ true , false]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderComplexOperationNodeOr() { assertThat(transform("1+2 || concat(a, b) || true"), is("{ \"$or\" : [ { \"$add\" : [ 1 , 2]} , { \"$concat\" : [ \"$a\" , \"$b\"]} , true]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderOperationNodeAnd() { assertThat(transform("true && false"), is("{ \"$and\" : [ true , false]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderComplexOperationNodeAnd() { assertThat(transform("1+2 && concat(a, b) && true"), is("{ \"$and\" : [ { \"$add\" : [ 1 , 2]} , { \"$concat\" : [ \"$a\" , \"$b\"]} , true]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderNotCorrectly() { assertThat(transform("!true"), is("{ \"$not\" : [ true]}")); } - /** - * @see DATAMONGO-1530 - */ - @Test + @Test // DATAMONGO-1530 public void shouldRenderComplexNotCorrectly() { assertThat(transform("!(foo > 10)"), is("{ \"$not\" : [ { \"$gt\" : [ \"$foo\" , 10]}]}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceIndexOfBytes() { assertThat(transform("indexOfBytes(item, 'foo')"), is("{ \"$indexOfBytes\" : [ \"$item\" , \"foo\"]}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceIndexOfCP() { assertThat(transform("indexOfCP(item, 'foo')"), is("{ \"$indexOfCP\" : [ \"$item\" , \"foo\"]}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceSplit() { assertThat(transform("split(item, ',')"), is("{ \"$split\" : [ \"$item\" , \",\"]}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceStrLenBytes() { assertThat(transform("strLenBytes(item)"), is("{ \"$strLenBytes\" : \"$item\"}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceStrLenCP() { assertThat(transform("strLenCP(item)"), is("{ \"$strLenCP\" : \"$item\"}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodSubstrCP() { assertThat(transform("substrCP(item, 0, 5)"), is("{ \"$substrCP\" : [ \"$item\" , 0 , 5]}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceReverseArray() { assertThat(transform("reverseArray(array)"), is("{ \"$reverseArray\" : \"$array\"}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceReduce() { assertThat(transform("reduce(field, '', {'$concat':new String[]{'$$value','$$this'}})"), is( "{ \"$reduce\" : { \"input\" : \"$field\" , \"initialValue\" : \"\" , \"in\" : { \"$concat\" : [ \"$$value\" , \"$$this\"]}}}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceZip() { assertThat(transform("zip(new String[]{'$array1', '$array2'})"), is("{ \"$zip\" : { \"inputs\" : [ \"$array1\" , \"$array2\"]}}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodReferenceZipWithOptionalArgs() { assertThat(transform("zip(new String[]{'$array1', '$array2'}, true, new int[]{1,2})"), is( "{ \"$zip\" : { \"inputs\" : [ \"$array1\" , \"$array2\"] , \"useLongestLength\" : true , \"defaults\" : [ 1 , 2]}}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodIn() { assertThat(transform("in('item', array)"), is("{ \"$in\" : [ \"item\" , \"$array\"]}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodRefereneIsoDayOfWeek() { assertThat(transform("isoDayOfWeek(date)"), is("{ \"$isoDayOfWeek\" : \"$date\"}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodRefereneIsoWeek() { assertThat(transform("isoWeek(date)"), is("{ \"$isoWeek\" : \"$date\"}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodRefereneIsoWeekYear() { assertThat(transform("isoWeekYear(date)"), is("{ \"$isoWeekYear\" : \"$date\"}")); } - /** - * @see DATAMONGO-1548 - */ - @Test + @Test // DATAMONGO-1548 public void shouldRenderMethodRefereneType() { assertThat(transform("type(a)"), is("{ \"$type\" : \"$a\"}")); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/TypeBasedAggregationOperationContextUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/TypeBasedAggregationOperationContextUnitTests.java index 42952d09d..76f086071 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/TypeBasedAggregationOperationContextUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/TypeBasedAggregationOperationContextUnitTests.java @@ -86,10 +86,7 @@ public class TypeBasedAggregationOperationContextUnitTests { getContext(Foo.class).getReference("foo"); } - /** - * @see DATAMONGO-741 - */ - @Test + @Test // DATAMONGO-741 public void returnsReferencesToNestedFieldsCorrectly() { AggregationOperationContext context = getContext(Foo.class); @@ -101,10 +98,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(context.getReference(field), is(context.getReference("bar.name"))); } - /** - * @see DATAMONGO-806 - */ - @Test + @Test // DATAMONGO-806 public void aliasesIdFieldCorrectly() { AggregationOperationContext context = getContext(Foo.class); @@ -112,10 +106,7 @@ public class TypeBasedAggregationOperationContextUnitTests { is((FieldReference) new DirectFieldReference(new ExposedField(field("id", "_id"), true)))); } - /** - * @see DATAMONGO-912 - */ - @Test + @Test // DATAMONGO-912 public void shouldUseCustomConversionIfPresentAndConversionIsRequiredInFirstStage() { CustomConversions customConversions = customAgeConversions(); @@ -133,10 +124,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(age, is((DBObject) new BasicDBObject("v", 10))); } - /** - * @see DATAMONGO-912 - */ - @Test + @Test // DATAMONGO-912 public void shouldUseCustomConversionIfPresentAndConversionIsRequiredInLaterStage() { CustomConversions customConversions = customAgeConversions(); @@ -154,10 +142,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(age, is((DBObject) new BasicDBObject("v", 10))); } - /** - * @see DATAMONGO-960 - */ - @Test + @Test // DATAMONGO-960 public void rendersAggregationOptionsInTypedAggregationContextCorrectly() { AggregationOperationContext context = getContext(FooPerson.class); @@ -177,10 +162,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(dbo.get("cursor"), is((Object) new BasicDBObject("foo", 1))); } - /** - * @see DATAMONGO-1585 - */ - @Test + @Test // DATAMONGO-1585 public void rendersSortOfProjectedFieldCorrectly() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -194,10 +176,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(definition.get("counter"), is(equalTo((Object) 1))); } - /** - * @see DATAMONGO-1586 - */ - @Test + @Test // DATAMONGO-1586 public void rendersFieldAliasingProjectionCorrectly() { AggregationOperationContext context = getContext(FooPerson.class); @@ -215,10 +194,7 @@ public class TypeBasedAggregationOperationContextUnitTests { .containing("age", "$age.value")); } - /** - * @see DATAMONGO-1133 - */ - @Test + @Test // DATAMONGO-1133 public void shouldHonorAliasedFieldsInGroupExpressions() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -233,10 +209,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(definition.get("_id"), is(equalTo((Object) "$counter_name"))); } - /** - * @see DATAMONGO-1326, DATAMONGO-1585 - */ - @Test + @Test // DATAMONGO-1326, DATAMONGO-1585 public void lookupShouldInheritFieldsFromInheritingAggregationOperation() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -253,10 +226,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(definition.get("counter_name"), is(equalTo((Object) 1))); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void groupLookupShouldInheritFieldsFromPreviousAggregationOperation() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -271,10 +241,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(definition.get("foreignKey"), is(equalTo((Object) 1))); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void lookupGroupAggregationShouldUseCorrectGroupField() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -291,10 +258,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(field.get("$min"), is(equalTo((Object) "$lookup.otherkey"))); } - /** - * @see DATAMONGO-1326 - */ - @Test + @Test // DATAMONGO-1326 public void lookupGroupAggregationShouldOverwriteExposedFields() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -311,10 +275,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat(definition.get("something_totally_different"), is(equalTo((Object) 1))); } - /** - * @see DATAMONGO-1326 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1326 public void lookupGroupAggregationShouldFailInvalidFieldReference() { TypeBasedAggregationOperationContext context = getContext(MeterData.class); @@ -325,10 +286,7 @@ public class TypeBasedAggregationOperationContextUnitTests { agg.toDbObject("meterData", context); } - /** - * @see DATAMONGO-861 - */ - @Test + @Test // DATAMONGO-861 public void rendersAggregationConditionalInTypedAggregationContextCorrectly() { AggregationOperationContext context = getContext(FooPerson.class); @@ -352,10 +310,7 @@ public class TypeBasedAggregationOperationContextUnitTests { assertThat((DBObject) getValue(age, "$cond"), isBsonObject().containing("else", "$age")); } - /** - * @see DATAMONGO-861, DATAMONGO-1542 - */ - @Test + @Test // DATAMONGO-861, DATAMONGO-1542 public void rendersAggregationIfNullInTypedAggregationContextCorrectly() { AggregationOperationContext context = getContext(FooPerson.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/UnwindOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/UnwindOperationUnitTests.java index 7327c0e87..b9baa8987 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/UnwindOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/UnwindOperationUnitTests.java @@ -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. @@ -32,10 +32,7 @@ import com.mongodb.DBObject; */ public class UnwindOperationUnitTests { - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindWithPathOnlyShouldUsePreMongo32Syntax() { UnwindOperation unwindOperation = Aggregation.unwind("a"); @@ -45,10 +42,7 @@ public class UnwindOperationUnitTests { assertThat(pipeline, isBsonObject().containing("$unwind", "$a")); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindWithArrayIndexShouldUseMongo32Syntax() { UnwindOperation unwindOperation = Aggregation.unwind("a", "index"); @@ -61,10 +55,7 @@ public class UnwindOperationUnitTests { containing("includeArrayIndex", "index")); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindWithArrayIndexShouldExposeArrayIndex() { UnwindOperation unwindOperation = Aggregation.unwind("a", "index"); @@ -72,10 +63,7 @@ public class UnwindOperationUnitTests { assertThat(unwindOperation.getFields().getField("index"), is(not(nullValue()))); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void plainUnwindShouldNotExposeIndex() { UnwindOperation unwindOperation = Aggregation.unwind("a"); @@ -83,10 +71,7 @@ public class UnwindOperationUnitTests { assertThat(unwindOperation.getFields().exposesNoFields(), is(true)); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void unwindWithPreserveNullShouldUseMongo32Syntax() { UnwindOperation unwindOperation = Aggregation.unwind("a", true); @@ -99,10 +84,7 @@ public class UnwindOperationUnitTests { notContaining("includeArrayIndex")); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void lookupBuilderBuildsCorrectClause() { UnwindOperation unwindOperation = UnwindOperation.newUnwind().path("$foo").noArrayIndex().skipNullAndEmptyArrays(); @@ -111,10 +93,7 @@ public class UnwindOperationUnitTests { assertThat(pipeline, isBsonObject().containing("$unwind", "$foo")); } - /** - * @see DATAMONGO-1391 - */ - @Test + @Test // DATAMONGO-1391 public void lookupBuilderBuildsCorrectClauseForMongo32() { UnwindOperation unwindOperation = UnwindOperation.newUnwind().path("$foo").arrayIndex("myindex") diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ZipInfo.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ZipInfo.java index 005085d25..4b63398d2 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ZipInfo.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ZipInfo.java @@ -7,8 +7,8 @@ import org.springframework.data.mongodb.core.mapping.Field; /** * Data model from mongodb reference data set * - * @see http://docs.mongodb.org/manual/tutorial/aggregation-examples/ - * @see http://media.mongodb.org/zips.json + * @see Aggregation Examples + * @see () { @@ -130,20 +124,14 @@ public class CustomConversionsUnitTests { assertThat(conversionService.canConvert(String.class, Format.class), is(true)); } - /** - * @see DATAMONGO-259 - */ - @Test + @Test // DATAMONGO-259 public void doesNotConsiderTypeSimpleIfOnlyReadConverterIsRegistered() { CustomConversions conversions = new CustomConversions(Arrays.asList(StringToFormatConverter.INSTANCE)); assertThat(conversions.isSimpleType(Format.class), is(false)); } - /** - * @see DATAMONGO-298 - */ - @Test + @Test // DATAMONGO-298 public void discoversConvertersForSubtypesOfMongoTypes() { CustomConversions conversions = new CustomConversions(Arrays.asList(StringToIntegerConverter.INSTANCE)); @@ -151,10 +139,7 @@ public class CustomConversionsUnitTests { assertThat(conversions.hasCustomWriteTarget(String.class, Integer.class), is(true)); } - /** - * @see DATAMONGO-342 - */ - @Test + @Test // DATAMONGO-342 public void doesNotHaveConverterForStringToBigIntegerByDefault() { CustomConversions conversions = new CustomConversions(); @@ -166,39 +151,27 @@ public class CustomConversionsUnitTests { assertThat(conversions.getCustomWriteTarget(String.class), is(nullValue())); } - /** - * @see DATAMONGO-390 - */ - @Test + @Test // DATAMONGO-390 public void considersBinaryASimpleType() { CustomConversions conversions = new CustomConversions(); assertThat(conversions.isSimpleType(Binary.class), is(true)); } - /** - * @see DATAMONGO-462 - */ - @Test + @Test // DATAMONGO-462 public void hasWriteConverterForURL() { CustomConversions conversions = new CustomConversions(); assertThat(conversions.hasCustomWriteTarget(URL.class), is(true)); } - /** - * @see DATAMONGO-462 - */ - @Test + @Test // DATAMONGO-462 public void readTargetForURL() { CustomConversions conversions = new CustomConversions(); assertThat(conversions.hasCustomReadTarget(String.class, URL.class), is(true)); } - /** - * @see DATAMONGO-795 - */ - @Test + @Test // DATAMONGO-795 @SuppressWarnings("rawtypes") public void favorsCustomConverterForIndeterminedTargetType() { @@ -206,10 +179,7 @@ public class CustomConversionsUnitTests { assertThat(conversions.getCustomWriteTarget(DateTime.class, null), is(equalTo((Class) String.class))); } - /** - * @see DATAMONGO-881 - */ - @Test + @Test // DATAMONGO-881 public void customConverterOverridesDefault() { CustomConversions conversions = new CustomConversions(Arrays.asList(CustomDateTimeConverter.INSTANCE)); @@ -219,30 +189,21 @@ public class CustomConversionsUnitTests { assertThat(conversionService.convert(new DateTime(), Date.class), is(new Date(0))); } - /** - * @see DATAMONGO-1001 - */ - @Test + @Test // DATAMONGO-1001 public void shouldSelectPropertCustomWriteTargetForCglibProxiedType() { CustomConversions conversions = new CustomConversions(Arrays.asList(FormatToStringConverter.INSTANCE)); assertThat(conversions.getCustomWriteTarget(createProxyTypeFor(Format.class)), is(typeCompatibleWith(String.class))); } - /** - * @see DATAMONGO-1001 - */ - @Test + @Test // DATAMONGO-1001 public void shouldSelectPropertCustomReadTargetForCglibProxiedType() { CustomConversions conversions = new CustomConversions(Arrays.asList(CustomObjectToStringConverter.INSTANCE)); assertThat(conversions.hasCustomReadTarget(createProxyTypeFor(Object.class), String.class), is(true)); } - /** - * @see DATAMONGO-1131 - */ - @Test + @Test // DATAMONGO-1131 public void registersConvertersForJsr310() { CustomConversions customConversions = new CustomConversions(); @@ -250,10 +211,7 @@ public class CustomConversionsUnitTests { assertThat(customConversions.hasCustomWriteTarget(java.time.LocalDateTime.class), is(true)); } - /** - * @see DATAMONGO-1131 - */ - @Test + @Test // DATAMONGO-1131 public void registersConvertersForThreeTenBackPort() { CustomConversions customConversions = new CustomConversions(); @@ -261,10 +219,7 @@ public class CustomConversionsUnitTests { assertThat(customConversions.hasCustomWriteTarget(LocalDateTime.class), is(true)); } - /** - * @see DATAMONGO-1302 - */ - @Test + @Test // DATAMONGO-1302 public void registersConverterFactoryCorrectly() { CustomConversions customConversions = new CustomConversions(Collections.singletonList(new FormatConverterFactory())); @@ -272,10 +227,7 @@ public class CustomConversionsUnitTests { assertThat(customConversions.getCustomWriteTarget(String.class, SimpleDateFormat.class), notNullValue()); } - /** - * @see DATAMONGO-1372 - */ - @Test + @Test // DATAMONGO-1372 public void registersConvertersForCurrency() { CustomConversions customConversions = new CustomConversions(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/CustomConvertersUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/CustomConvertersUnitTests.java index e26394f11..236c9d3f7 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/CustomConvertersUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/CustomConvertersUnitTests.java @@ -41,7 +41,6 @@ import com.mongodb.DBObject; * Test case to verify correct usage of custom {@link Converter} implementations to be used. * * @author Oliver Gierke - * @see DATADOC-101 */ @RunWith(MockitoJUnitRunner.class) public class CustomConvertersUnitTests { @@ -75,7 +74,7 @@ public class CustomConvertersUnitTests { converter.afterPropertiesSet(); } - @Test + @Test // DATADOC-101 public void nestedToDBObjectConverterGetsInvoked() { Foo foo = new Foo(); @@ -85,7 +84,7 @@ public class CustomConvertersUnitTests { verify(barToDBObjectConverter).convert(any(Bar.class)); } - @Test + @Test // DATADOC-101 public void nestedFromDBObjectConverterGetsInvoked() { BasicDBObject dbObject = new BasicDBObject(); @@ -95,21 +94,21 @@ public class CustomConvertersUnitTests { verify(dbObjectToBarConverter).convert(any(DBObject.class)); } - @Test + @Test // DATADOC-101 public void toDBObjectConverterGetsInvoked() { converter.write(new Bar(), new BasicDBObject()); verify(barToDBObjectConverter).convert(any(Bar.class)); } - @Test + @Test // DATADOC-101 public void fromDBObjectConverterGetsInvoked() { converter.read(Bar.class, new BasicDBObject()); verify(dbObjectToBarConverter).convert(any(DBObject.class)); } - @Test + @Test // DATADOC-101 public void foo() { DBObject dbObject = new BasicDBObject(); dbObject.put("foo", null); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DBObjectAccessorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DBObjectAccessorUnitTests.java index 298d99c1d..2808759e2 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DBObjectAccessorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DBObjectAccessorUnitTests.java @@ -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. @@ -30,9 +30,8 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBObject; /** - * Unit tests for {@link DbObjectAccessor}. + * Unit tests for {@link DBObjectAccessor}. * - * @see DATAMONGO-766 * @author Oliver Gierke */ public class DBObjectAccessorUnitTests { @@ -41,7 +40,7 @@ public class DBObjectAccessorUnitTests { MongoPersistentEntity projectingTypeEntity = context.getPersistentEntity(ProjectingType.class); MongoPersistentProperty fooProperty = projectingTypeEntity.getPersistentProperty("foo"); - @Test + @Test // DATAMONGO-766 public void putsNestedFieldCorrectly() { DBObject dbObject = new BasicDBObject(); @@ -53,7 +52,7 @@ public class DBObjectAccessorUnitTests { assertThat(aDbObject.get("b"), is((Object) "FooBar")); } - @Test + @Test // DATAMONGO-766 public void getsNestedFieldCorrectly() { DBObject source = new BasicDBObject("a", new BasicDBObject("b", "FooBar")); @@ -62,27 +61,24 @@ public class DBObjectAccessorUnitTests { assertThat(accessor.get(fooProperty), is((Object) "FooBar")); } - @Test + @Test // DATAMONGO-766 public void returnsNullForNonExistingFieldPath() { DBObjectAccessor accessor = new DBObjectAccessor(new BasicDBObject()); assertThat(accessor.get(fooProperty), is(nullValue())); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-766 public void rejectsNonBasicDBObjects() { new DBObjectAccessor(new BasicDBList()); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-766 public void rejectsNullDBObject() { new DBObjectAccessor(null); } - /** - * @see DATAMONGO-1335 - */ - @Test + @Test // DATAMONGO-1335 public void writesAllNestingsCorrectly() { MongoPersistentEntity entity = context.getPersistentEntity(TypeWithTwoNestings.class); @@ -101,10 +97,7 @@ public class DBObjectAccessorUnitTests { assertThat(nestedA.get("c"), is((Object) "c")); } - /** - * @see DATAMONGO-1471 - */ - @Test + @Test // DATAMONGO-1471 public void exposesAvailabilityOfFields() { DBObjectAccessor accessor = new DBObjectAccessor(new BasicDBObject("a", new BasicDBObject("c", "d"))); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DataMongo273Tests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DataMongo273Tests.java index 5c3ae804e..7ac9c62f7 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DataMongo273Tests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DataMongo273Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2012 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. @@ -51,10 +51,7 @@ public class DataMongo273Tests { converter.afterPropertiesSet(); } - /** - * @see DATAMONGO-273 - */ - @Test + @Test // DATAMONGO-273 public void convertMapOfThings() { Plane plane = new Plane("Boeing", 4); @@ -77,10 +74,7 @@ public class DataMongo273Tests { assertTrue(mapOfThings2.get("automobile") instanceof Automobile); } - /** - * @see DATAMONGO-294 - */ - @Test + @Test // DATAMONGO-294 @SuppressWarnings({ "rawtypes", "unchecked" }) public void convertListOfThings() { Plane plane = new Plane("Boeing", 4); @@ -102,10 +96,7 @@ public class DataMongo273Tests { assertTrue(listOfThings2.get(2) instanceof Automobile); } - /** - * @see DATAMONGO-294 - */ - @Test + @Test // DATAMONGO-294 @SuppressWarnings({ "rawtypes", "unchecked" }) public void convertListOfThings_NestedInMap() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DbRefMappingMongoConverterUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DbRefMappingMongoConverterUnitTests.java index 001884015..240ce9760 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DbRefMappingMongoConverterUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DbRefMappingMongoConverterUnitTests.java @@ -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. @@ -87,10 +87,7 @@ public class DbRefMappingMongoConverterUnitTests { this.converter = new MappingMongoConverter(dbRefResolver, mappingContext); } - /** - * @see DATAMONGO-347 - */ - @Test + @Test // DATAMONGO-347 public void createsSimpleDBRefCorrectly() { Person person = new Person(); @@ -101,10 +98,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(dbRef.getCollectionName(), is("person")); } - /** - * @see DATAMONGO-657 - */ - @Test + @Test // DATAMONGO-657 public void convertDocumentWithMapDBRef() { DBObject mapValDBObject = new BasicDBObject(); @@ -146,10 +140,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(read.map.get("test").id, is(BigInteger.ONE)); } - /** - * @see DATAMONGO-347 - */ - @Test + @Test // DATAMONGO-347 public void createsDBRefWithClientSpecCorrectly() { PropertyPath path = PropertyPath.from("person", PersonClient.class); @@ -163,10 +154,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(dbRef.getCollectionName(), is("person")); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void lazyLoadingProxyForLazyDbRefOnInterface() { String id = "42"; @@ -187,10 +175,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(result.dbRefToInterface.get(0).getValue(), is(value)); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void lazyLoadingProxyForLazyDbRefOnConcreteCollection() { String id = "42"; @@ -212,10 +197,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(result.dbRefToConcreteCollection.get(0).getValue(), is(value)); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void lazyLoadingProxyForLazyDbRefOnConcreteType() { String id = "42"; @@ -236,10 +218,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(result.dbRefToConcreteType.getValue(), is(value)); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void lazyLoadingProxyForLazyDbRefOnConcreteTypeWithPersistenceConstructor() { String id = "42"; @@ -261,10 +240,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(result.dbRefToConcreteTypeWithPersistenceConstructor.getValue(), is(value)); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void lazyLoadingProxyForLazyDbRefOnConcreteTypeWithPersistenceConstructorButWithoutDefaultConstructor() { String id = "42"; @@ -286,10 +262,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(result.dbRefToConcreteTypeWithPersistenceConstructorWithoutDefaultConstructor.getValue(), is(value)); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void lazyLoadingProxyForSerializableLazyDbRefOnConcreteType() { String id = "42"; @@ -311,10 +284,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(deserializedResult.dbRefToSerializableTarget.getValue(), is(value)); } - /** - * @see DATAMONGO-884 - */ - @Test + @Test // DATAMONGO-884 public void lazyLoadingProxyForToStringObjectMethodOverridingDbref() { String id = "42"; @@ -335,10 +305,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefToToStringObjectMethodOverride, true); } - /** - * @see DATAMONGO-884 - */ - @Test + @Test // DATAMONGO-884 public void callingToStringObjectMethodOnLazyLoadingDbrefShouldNotInitializeProxy() { String id = "42"; @@ -366,10 +333,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefToPlainObject, true); } - /** - * @see DATAMONGO-884 - */ - @Test + @Test // DATAMONGO-884 public void equalsObjectMethodOnLazyLoadingDbrefShouldNotInitializeProxy() { String id = "42"; @@ -395,10 +359,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefToPlainObject, false); } - /** - * @see DATAMONGO-884 - */ - @Test + @Test // DATAMONGO-884 public void hashcodeObjectMethodOnLazyLoadingDbrefShouldNotInitializeProxy() { String id = "42"; @@ -422,10 +383,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefToPlainObject, false); } - /** - * @see DATAMONGO-884 - */ - @Test + @Test // DATAMONGO-884 public void lazyLoadingProxyForEqualsAndHashcodeObjectMethodOverridingDbref() { String id = "42"; @@ -454,10 +412,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefEqualsAndHashcodeObjectMethodOverride2, true); } - /** - * @see DATAMONGO-987 - */ - @Test + @Test // DATAMONGO-987 public void shouldNotGenerateLazyLoadingProxyForNullValues() { DBObject dbo = new BasicDBObject(); @@ -475,10 +430,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(result.dbRefToConcreteTypeWithPersistenceConstructorWithoutDefaultConstructor, is(nullValue())); } - /** - * @see DATAMONGO-1005 - */ - @Test + @Test // DATAMONGO-1005 public void shouldBeAbleToStoreDirectReferencesToSelf() { DBObject dbo = new BasicDBObject(); @@ -494,10 +446,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(found.reference, is(found)); } - /** - * @see DATAMONGO-1005 - */ - @Test + @Test // DATAMONGO-1005 public void shouldBeAbleToStoreNestedReferencesToSelf() { DBObject dbo = new BasicDBObject(); @@ -516,10 +465,7 @@ public class DbRefMappingMongoConverterUnitTests { assertThat(found.nested.reference, is(found)); } - /** - * @see DATAMONGO-1012 - */ - @Test + @Test // DATAMONGO-1012 public void shouldEagerlyResolveIdPropertyWithFieldAccess() { MongoPersistentEntity entity = mappingContext.getPersistentEntity(ClassWithLazyDbRefs.class); @@ -540,10 +486,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefToConcreteType, false); } - /** - * @see DATAMONGO-1012 - */ - @Test + @Test // DATAMONGO-1012 public void shouldNotEagerlyResolveIdPropertyWithPropertyAccess() { MongoPersistentEntity entity = mappingContext.getPersistentEntity(ClassWithLazyDbRefs.class); @@ -561,10 +504,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(proxy, false); } - /** - * @see DATAMONGO-1076 - */ - @Test + @Test // DATAMONGO-1076 public void shouldNotTriggerResolvingOfLazyLoadedProxyWhenFinalizeMethodIsInvoked() throws Exception { MongoPersistentEntity entity = mappingContext.getPersistentEntity(WithObjectMethodOverrideLazyDbRefs.class); @@ -581,10 +521,7 @@ public class DbRefMappingMongoConverterUnitTests { assertProxyIsResolved(result.dbRefToPlainObject, false); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldBulkFetchListOfReferences() { String id1 = "1"; @@ -611,10 +548,7 @@ public class DbRefMappingMongoConverterUnitTests { verify(converterSpy, never()).readRef(Mockito.any(DBRef.class)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldFallbackToOneByOneFetchingWhenElementsInListOfReferencesPointToDifferentCollections() { String id1 = "1"; @@ -643,10 +577,7 @@ public class DbRefMappingMongoConverterUnitTests { verify(converterSpy, never()).bulkReadRefs(anyListOf(DBRef.class)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldBulkFetchMapOfReferences() { MapDBRefVal val1 = new MapDBRefVal(); @@ -678,10 +609,7 @@ public class DbRefMappingMongoConverterUnitTests { verify(converterSpy, never()).readRef(Mockito.any(DBRef.class)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void shouldBulkFetchLazyMapOfReferences() { MapDBRefVal val1 = new MapDBRefVal(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultDbRefResolverUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultDbRefResolverUnitTests.java index 8bbfdde43..ba444fe25 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultDbRefResolverUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultDbRefResolverUnitTests.java @@ -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. @@ -69,10 +69,7 @@ public class DefaultDbRefResolverUnitTests { resolver = new DefaultDbRefResolver(factoryMock); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 @SuppressWarnings("unchecked") public void bulkFetchShouldLoadDbRefsCorrectly() { @@ -91,10 +88,7 @@ public class DefaultDbRefResolverUnitTests { assertThat($in, iterableWithSize(2)); } - /** - * @see DATAMONGO-1194 - */ - @Test(expected = InvalidDataAccessApiUsageException.class) + @Test(expected = InvalidDataAccessApiUsageException.class) // DATAMONGO-1194 public void bulkFetchShouldThrowExceptionWhenUsingDifferntCollectionsWithinSetOfReferences() { DBRef ref1 = new DBRef("collection-1", new ObjectId()); @@ -103,10 +97,7 @@ public class DefaultDbRefResolverUnitTests { resolver.bulkFetch(Arrays.asList(ref1, ref2)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void bulkFetchShouldReturnEarlyForEmptyLists() { resolver.bulkFetch(Collections.emptyList()); @@ -114,10 +105,7 @@ public class DefaultDbRefResolverUnitTests { verify(collectionMock, never()).find(Mockito.any(DBObject.class)); } - /** - * @see DATAMONGO-1194 - */ - @Test + @Test // DATAMONGO-1194 public void bulkFetchShouldRestoreOriginalOrder() { DBObject o1 = new BasicDBObject("_id", new ObjectId()); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapperUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapperUnitTests.java index 2cb4560cc..0678922cf 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapperUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapperUnitTests.java @@ -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. @@ -109,10 +109,7 @@ public class DefaultMongoTypeMapperUnitTests { Object.class); } - /** - * @see DATAMONGO-709 - */ - @Test + @Test // DATAMONGO-709 public void writesTypeRestrictionsCorrectly() { DBObject result = new BasicDBObject(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoConvertersUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoConvertersUnitTests.java index 3ff7f3e51..2c3133116 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoConvertersUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoConvertersUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,10 +52,7 @@ import com.mongodb.DBObject; */ public class GeoConvertersUnitTests { - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsBoxToDbObjectAndBackCorrectly() { Box box = new Box(new Point(1, 2), new Point(3, 4)); @@ -67,10 +64,7 @@ public class GeoConvertersUnitTests { assertThat(result.getClass().equals(Box.class), is(true)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsCircleToDbObjectAndBackCorrectlyNeutralDistance() { Circle circle = new Circle(new Point(1, 2), 3); @@ -81,10 +75,7 @@ public class GeoConvertersUnitTests { assertThat(result, is(circle)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsCircleToDbObjectAndBackCorrectlyMilesDistance() { Distance radius = new Distance(3, Metrics.MILES); @@ -97,10 +88,7 @@ public class GeoConvertersUnitTests { assertThat(result.getRadius(), is(radius)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsPolygonToDbObjectAndBackCorrectly() { Polygon polygon = new Polygon(new Point(1, 2), new Point(2, 3), new Point(3, 4), new Point(5, 6)); @@ -112,10 +100,7 @@ public class GeoConvertersUnitTests { assertThat(result.getClass().equals(Polygon.class), is(true)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsSphereToDbObjectAndBackCorrectlyWithNeutralDistance() { Sphere sphere = new Sphere(new Point(1, 2), 3); @@ -127,10 +112,7 @@ public class GeoConvertersUnitTests { assertThat(result.getClass().equals(Sphere.class), is(true)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsSphereToDbObjectAndBackCorrectlyWithKilometerDistance() { Distance radius = new Distance(3, Metrics.KILOMETERS); @@ -144,10 +126,7 @@ public class GeoConvertersUnitTests { assertThat(result.getClass().equals(org.springframework.data.mongodb.core.geo.Sphere.class), is(true)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsPointToListAndBackCorrectly() { Point point = new Point(1, 2); @@ -159,10 +138,7 @@ public class GeoConvertersUnitTests { assertThat(result.getClass().equals(Point.class), is(true)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsGeoCommandToDbObjectCorrectly() { Box box = new Box(new double[] { 1, 2 }, new double[] { 3, 4 }); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoJsonConverterUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoJsonConverterUnitTests.java index 935d135e8..24e98979a 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoJsonConverterUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/GeoJsonConverterUnitTests.java @@ -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. @@ -185,26 +185,17 @@ public class GeoJsonConverterUnitTests { DbObjectToGeoJsonPolygonConverter converter = DbObjectToGeoJsonPolygonConverter.INSTANCE; public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertDboCorrectly() { assertThat(converter.convert(POLYGON_DBO), equalTo(POLYGON)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldReturnNullWhenConvertIsGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldThrowExceptionWhenTypeDoesNotMatchPolygon() { expectedException.expect(IllegalArgumentException.class); @@ -213,10 +204,7 @@ public class GeoJsonConverterUnitTests { converter.convert(new BasicDBObject("type", "YouDontKonwMe")); } - /** - * @see DATAMONGO-1399 - */ - @Test + @Test // DATAMONGO-1399 public void shouldConvertDboWithMultipleRingsCorrectly() { assertThat(converter.convert(POLYGON_WITH_2_RINGS_DBO), equalTo(POLYGON_WITH_2_RINGS)); } @@ -231,26 +219,17 @@ public class GeoJsonConverterUnitTests { DbObjectToGeoJsonPointConverter converter = DbObjectToGeoJsonPointConverter.INSTANCE; public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertDboCorrectly() { assertThat(converter.convert(SINGLE_POINT_DBO), equalTo(SINGLE_POINT)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldReturnNullWhenConvertIsGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldThrowExceptionWhenTypeDoesNotMatchPoint() { expectedException.expect(IllegalArgumentException.class); @@ -268,26 +247,17 @@ public class GeoJsonConverterUnitTests { DbObjectToGeoJsonLineStringConverter converter = DbObjectToGeoJsonLineStringConverter.INSTANCE; public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertDboCorrectly() { assertThat(converter.convert(LINE_STRING_DBO), equalTo(LINE_STRING)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldReturnNullWhenConvertIsGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldThrowExceptionWhenTypeDoesNotMatchPoint() { expectedException.expect(IllegalArgumentException.class); @@ -305,26 +275,17 @@ public class GeoJsonConverterUnitTests { DbObjectToGeoJsonMultiLineStringConverter converter = DbObjectToGeoJsonMultiLineStringConverter.INSTANCE; public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertDboCorrectly() { assertThat(converter.convert(MULTI_LINE_STRING_DBO), equalTo(MULTI_LINE_STRING)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldReturnNullWhenConvertIsGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldThrowExceptionWhenTypeDoesNotMatchPoint() { expectedException.expect(IllegalArgumentException.class); @@ -342,26 +303,17 @@ public class GeoJsonConverterUnitTests { DbObjectToGeoJsonMultiPointConverter converter = DbObjectToGeoJsonMultiPointConverter.INSTANCE; public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertDboCorrectly() { assertThat(converter.convert(MULTI_POINT_DBO), equalTo(MULTI_POINT)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldReturnNullWhenConvertIsGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldThrowExceptionWhenTypeDoesNotMatchPoint() { expectedException.expect(IllegalArgumentException.class); @@ -379,26 +331,17 @@ public class GeoJsonConverterUnitTests { DbObjectToGeoJsonMultiPolygonConverter converter = DbObjectToGeoJsonMultiPolygonConverter.INSTANCE; public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertDboCorrectly() { assertThat(converter.convert(MULTI_POLYGON_DBO), equalTo(MULTI_POLYGON)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldReturnNullWhenConvertIsGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldThrowExceptionWhenTypeDoesNotMatchPoint() { expectedException.expect(IllegalArgumentException.class); @@ -415,73 +358,47 @@ public class GeoJsonConverterUnitTests { GeoJsonToDbObjectConverter converter = GeoJsonToDbObjectConverter.INSTANCE; - /** - * @see DATAMONGO-1135 - */ + // DATAMONGO-1135 public void convertShouldReturnNullWhenGivenNull() { assertThat(converter.convert(null), nullValue()); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void shouldConvertGeoJsonPointCorrectly() { assertThat(converter.convert(SINGLE_POINT), equalTo(SINGLE_POINT_DBO)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void shouldConvertGeoJsonPolygonCorrectly() { assertThat(converter.convert(POLYGON), equalTo(POLYGON_DBO)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertGeoJsonLineStringCorrectly() { assertThat(converter.convert(LINE_STRING), equalTo(LINE_STRING_DBO)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertGeoJsonMultiLineStringCorrectly() { assertThat(converter.convert(MULTI_LINE_STRING), equalTo(MULTI_LINE_STRING_DBO)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertGeoJsonMultiPointCorrectly() { assertThat(converter.convert(MULTI_POINT), equalTo(MULTI_POINT_DBO)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertGeoJsonMultiPolygonCorrectly() { assertThat(converter.convert(MULTI_POLYGON), equalTo(MULTI_POLYGON_DBO)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouldConvertGeometryCollectionCorrectly() { assertThat(converter.convert(GEOMETRY_COLLECTION), equalTo(GEOMETRY_COLLECTION_DBO)); } - /** - * @see DATAMONGO-1399 - */ - @Test + @Test // DATAMONGO-1399 public void shouldConvertGeoJsonPolygonWithMultipleRingsCorrectly() { assertThat(converter.convert(POLYGON_WITH_2_RINGS), equalTo(POLYGON_WITH_2_RINGS_DBO)); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/LazyLoadingInterceptorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/LazyLoadingInterceptorUnitTests.java index 1cdfb776b..bec7e31ea 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/LazyLoadingInterceptorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/LazyLoadingInterceptorUnitTests.java @@ -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. @@ -47,10 +47,7 @@ public class LazyLoadingInterceptorUnitTests { @Mock DBRef dbrefMock; @Mock DbRefResolverCallback callbackMock; - /** - * @see DATAMONGO-1437 - */ - @Test + @Test // DATAMONGO-1437 public void shouldPreserveCauseForNonTranslatableExceptions() throws Throwable { NullPointerException npe = new NullPointerException("Some Exception we did not think about."); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MappingMongoConverterUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MappingMongoConverterUnitTests.java index a1530194a..c4a0dfdb3 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MappingMongoConverterUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MappingMongoConverterUnitTests.java @@ -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. @@ -166,10 +166,7 @@ public class MappingMongoConverterUnitTests { converter.convertToMongoType(date); } - /** - * @see DATAMONGO-130 - */ - @Test + @Test // DATAMONGO-130 public void writesMapTypeCorrectly() { Map map = Collections.singletonMap(Locale.US, "Foo"); @@ -180,10 +177,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbObject.get(Locale.US.toString()).toString(), is("Foo")); } - /** - * @see DATAMONGO-130 - */ - @Test + @Test // DATAMONGO-130 public void readsMapWithCustomKeyTypeCorrectly() { DBObject mapObject = new BasicDBObject(Locale.US.toString(), "Value"); @@ -193,10 +187,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.map.get(Locale.US), is("Value")); } - /** - * @see DATAMONGO-128 - */ - @Test + @Test // DATAMONGO-128 public void usesDocumentsStoredTypeIfSubtypeOfRequest() { DBObject dbObject = new BasicDBObject(); @@ -206,10 +197,7 @@ public class MappingMongoConverterUnitTests { assertThat(converter.read(Contact.class, dbObject), is(instanceOf(Person.class))); } - /** - * @see DATAMONGO-128 - */ - @Test + @Test // DATAMONGO-128 public void ignoresDocumentsStoredTypeIfCompletelyDifferentTypeRequested() { DBObject dbObject = new BasicDBObject(); @@ -231,10 +219,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.get(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY).toString(), is(Person.class.getName())); } - /** - * @see DATAMONGO-136 - */ - @Test + @Test // DATAMONGO-136 public void writesEnumsCorrectly() { ClassWithEnumProperty value = new ClassWithEnumProperty(); @@ -247,10 +232,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.get("sampleEnum").toString(), is("FIRST")); } - /** - * @see DATAMONGO-209 - */ - @Test + @Test // DATAMONGO-209 public void writesEnumCollectionCorrectly() { ClassWithEnumProperty value = new ClassWithEnumProperty(); @@ -266,10 +248,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) enums.get(0), is("FIRST")); } - /** - * @see DATAMONGO-136 - */ - @Test + @Test // DATAMONGO-136 public void readsEnumsCorrectly() { DBObject dbObject = new BasicDBObject("sampleEnum", "FIRST"); ClassWithEnumProperty result = converter.read(ClassWithEnumProperty.class, dbObject); @@ -277,10 +256,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.sampleEnum, is(SampleEnum.FIRST)); } - /** - * @see DATAMONGO-209 - */ - @Test + @Test // DATAMONGO-209 public void readsEnumCollectionsCorrectly() { BasicDBList enums = new BasicDBList(); @@ -294,10 +270,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.enums, hasItem(SampleEnum.FIRST)); } - /** - * @see DATAMONGO-144 - */ - @Test + @Test // DATAMONGO-144 public void considersFieldNameWhenWriting() { Person person = new Person(); @@ -310,10 +283,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.containsField("firstname"), is(false)); } - /** - * @see DATAMONGO-144 - */ - @Test + @Test // DATAMONGO-144 public void considersFieldNameWhenReading() { DBObject dbObject = new BasicDBObject("foo", "Oliver"); @@ -338,10 +308,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.addresses, is(notNullValue())); } - /** - * @see DATAMONGO-145 - */ - @Test + @Test // DATAMONGO-145 public void writesCollectionWithInterfaceCorrectly() { Person person = new Person(); @@ -361,10 +328,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) personDbObject.get(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY), is(Person.class.getName())); } - /** - * @see DATAMONGO-145 - */ - @Test + @Test // DATAMONGO-145 public void readsCollectionWithInterfaceCorrectly() { BasicDBObject person = new BasicDBObject(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY, Person.class.getName()); @@ -397,10 +361,7 @@ public class MappingMongoConverterUnitTests { assertThat(read.locale, is(Locale.US)); } - /** - * @see DATAMONGO-161 - */ - @Test + @Test // DATAMONGO-161 public void readsNestedMapsCorrectly() { Map secondLevel = new HashMap(); @@ -424,10 +385,7 @@ public class MappingMongoConverterUnitTests { assertThat(nestedMap.get("afield"), is(firstLevel)); } - /** - * @see DATACMNS-42, DATAMONGO-171 - */ - @Test + @Test // DATACMNS-42, DATAMONGO-171 public void writesClassWithBigDecimal() { BigDecimalContainer container = new BigDecimalContainer(); @@ -442,10 +400,7 @@ public class MappingMongoConverterUnitTests { assertThat(((DBObject) dbObject.get("map")).get("foo"), is(instanceOf(String.class))); } - /** - * @see DATACMNS-42, DATAMONGO-171 - */ - @Test + @Test // DATACMNS-42, DATAMONGO-171 public void readsClassWithBigDecimal() { DBObject dbObject = new BasicDBObject("value", "2.5"); @@ -478,10 +433,7 @@ public class MappingMongoConverterUnitTests { assertThat(typedOuterString.size(), is(1)); } - /** - * @see DATAMONGO-192 - */ - @Test + @Test // DATAMONGO-192 public void readsEmptySetsCorrectly() { Person person = new Person(); @@ -507,10 +459,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbo2.get("_id"), is(instanceOf(ObjectId.class))); } - /** - * @see DATAMONGO-207 - */ - @Test + @Test // DATAMONGO-207 public void convertsCustomEmptyMapCorrectly() { DBObject map = new BasicDBObject(); @@ -522,10 +471,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.map, is(instanceOf(SortedMap.class))); } - /** - * @see DATAMONGO-211 - */ - @Test + @Test // DATAMONGO-211 public void maybeConvertHandlesNullValuesCorrectly() { assertThat(converter.convertToMongoType(null), is(nullValue())); } @@ -556,10 +502,7 @@ public class MappingMongoConverterUnitTests { } - /** - * @see DATAMONGO-228 - */ - @Test + @Test // DATAMONGO-228 public void writesNullValuesForMaps() { ClassWithMapProperty foo = new ClassWithMapProperty(); @@ -591,10 +534,7 @@ public class MappingMongoConverterUnitTests { assertThat(converter.convertToMongoType(id), is((Object) id)); } - /** - * @see DATAMONGO-235 - */ - @Test + @Test // DATAMONGO-235 public void writesMapOfListsCorrectly() { ClassWithMapProperty input = new ClassWithMapProperty(); @@ -615,10 +555,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) value.get(0), is("Bar")); } - /** - * @see DATAMONGO-235 - */ - @Test + @Test // DATAMONGO-235 public void readsMapListValuesCorrectly() { BasicDBList list = new BasicDBList(); @@ -629,10 +566,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.mapOfLists, is(not(nullValue()))); } - /** - * @see DATAMONGO-235 - */ - @Test + @Test // DATAMONGO-235 public void writesMapsOfObjectsCorrectly() { ClassWithMapProperty input = new ClassWithMapProperty(); @@ -654,10 +588,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) value.get(0), is("Bar")); } - /** - * @see DATAMONGO-235 - */ - @Test + @Test // DATAMONGO-235 public void readsMapOfObjectsListValuesCorrectly() { BasicDBList list = new BasicDBList(); @@ -668,10 +599,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.mapOfObjects, is(not(nullValue()))); } - /** - * @see DATAMONGO-245 - */ - @Test + @Test // DATAMONGO-245 public void readsMapListNestedValuesCorrectly() { BasicDBList list = new BasicDBList(); @@ -684,10 +612,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) ((Map) firstObjectInFoo).get("Hello"), is(equalTo("World"))); } - /** - * @see DATAMONGO-245 - */ - @Test + @Test // DATAMONGO-245 public void readsMapDoublyNestedValuesCorrectly() { BasicDBObject nested = new BasicDBObject(); @@ -704,10 +629,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) ((Map) doublyNestedObject).get("Hello"), is(equalTo("World"))); } - /** - * @see DATAMONGO-245 - */ - @Test + @Test // DATAMONGO-245 public void readsMapListDoublyNestedValuesCorrectly() { BasicDBList list = new BasicDBList(); @@ -726,10 +648,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) ((Map) doublyNestedObject).get("Hello"), is(equalTo("World"))); } - /** - * @see DATAMONGO-259 - */ - @Test + @Test // DATAMONGO-259 public void writesListOfMapsCorrectly() { Map map = Collections.singletonMap("Foo", Locale.ENGLISH); @@ -750,10 +669,7 @@ public class MappingMongoConverterUnitTests { assertThat((String) dbObject.get("Foo"), is(Locale.ENGLISH.toString())); } - /** - * @see DATAMONGO-259 - */ - @Test + @Test // DATAMONGO-259 public void readsListOfMapsCorrectly() { DBObject map = new BasicDBObject("Foo", "en"); @@ -771,10 +687,7 @@ public class MappingMongoConverterUnitTests { assertThat(wrapper.listOfMaps.get(0).get("Foo"), is(Locale.ENGLISH)); } - /** - * @see DATAMONGO-259 - */ - @Test + @Test // DATAMONGO-259 public void writesPlainMapOfCollectionsCorrectly() { Map> map = Collections.singletonMap("Foo", Arrays.asList(Locale.US)); @@ -791,10 +704,7 @@ public class MappingMongoConverterUnitTests { assertThat(list.get(0), is((Object) Locale.US.toString())); } - /** - * @see DATAMONGO-285 - */ - @Test + @Test // DATAMONGO-285 @SuppressWarnings({ "unchecked", "rawtypes" }) public void testSaveMapWithACollectionAsValue() { @@ -819,10 +729,7 @@ public class MappingMongoConverterUnitTests { assertEquals(list.get(1), listFromMongo.get(1)); } - /** - * @see DATAMONGO-309 - */ - @Test + @Test // DATAMONGO-309 @SuppressWarnings({ "unchecked" }) public void writesArraysAsMapValuesCorrectly() { @@ -845,10 +752,7 @@ public class MappingMongoConverterUnitTests { assertThat(list, hasItem((Object) "bar")); } - /** - * @see DATAMONGO-324 - */ - @Test + @Test // DATAMONGO-324 public void writesDbObjectCorrectly() { DBObject dbObject = new BasicDBObject(); @@ -862,10 +766,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbObject, is(result)); } - /** - * @see DATAMONGO-324 - */ - @Test + @Test // DATAMONGO-324 public void readsDbObjectCorrectly() { DBObject dbObject = new BasicDBObject(); @@ -876,10 +777,7 @@ public class MappingMongoConverterUnitTests { assertThat(result, is(dbObject)); } - /** - * @see DATAMONGO-329 - */ - @Test + @Test // DATAMONGO-329 public void writesMapAsGenericFieldCorrectly() { Map> objectToSave = new HashMap>(); @@ -915,10 +813,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.get("_id"), is((Object) 5)); } - /** - * @see DATAMONGO-368 - */ - @Test + @Test // DATAMONGO-368 @SuppressWarnings("unchecked") public void writesNullValuesForCollection() { @@ -934,10 +829,7 @@ public class MappingMongoConverterUnitTests { assertThat((Collection) contacts, hasItem(nullValue())); } - /** - * @see DATAMONGO-379 - */ - @Test + @Test // DATAMONGO-379 public void considersDefaultingExpressionsAtConstructorArguments() { DBObject dbObject = new BasicDBObject("foo", "bar"); @@ -947,10 +839,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.bar, is(-1)); } - /** - * @see DATAMONGO-379 - */ - @Test + @Test // DATAMONGO-379 public void usesDocumentFieldIfReferencedInAtValue() { DBObject dbObject = new BasicDBObject("foo", "bar"); @@ -961,10 +850,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.bar, is(37)); } - /** - * @see DATAMONGO-379 - */ - @Test(expected = MappingInstantiationException.class) + @Test(expected = MappingInstantiationException.class) // DATAMONGO-379 public void rejectsNotFoundConstructorParameterForPrimitiveType() { DBObject dbObject = new BasicDBObject("foo", "bar"); @@ -972,10 +858,7 @@ public class MappingMongoConverterUnitTests { converter.read(DefaultedConstructorArgument.class, dbObject); } - /** - * @see DATAMONGO-358 - */ - @Test + @Test // DATAMONGO-358 public void writesListForObjectPropertyCorrectly() { Attribute attribute = new Attribute(); @@ -1001,18 +884,12 @@ public class MappingMongoConverterUnitTests { assertThat(values, hasItems("1", "2")); } - /** - * @see DATAMONGO-380 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-380 public void rejectsMapWithKeyContainingDotsByDefault() { converter.write(Collections.singletonMap("foo.bar", "foobar"), new BasicDBObject()); } - /** - * @see DATAMONGO-380 - */ - @Test + @Test // DATAMONGO-380 public void escapesDotInMapKeysIfReplacementConfigured() { converter.setMapKeyDotReplacement("~"); @@ -1024,10 +901,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbObject.containsField("foo.bar"), is(false)); } - /** - * @see DATAMONGO-380 - */ - @Test + @Test // DATAMONGO-380 @SuppressWarnings("unchecked") public void unescapesDotInMapKeysIfReplacementConfigured() { @@ -1040,10 +914,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.containsKey("foobar"), is(false)); } - /** - * @see DATAMONGO-382 - */ - @Test + @Test // DATAMONGO-382 public void convertsSetToBasicDBList() { Address address = new Address(); @@ -1058,10 +929,7 @@ public class MappingMongoConverterUnitTests { assertThat(readResult.iterator().next(), is(instanceOf(Address.class))); } - /** - * @see DATAMONGO-402 - */ - @Test + @Test // DATAMONGO-402 public void readsMemberClassCorrectly() { DBObject dbObject = new BasicDBObject("inner", new BasicDBObject("value", "FOO!")); @@ -1072,10 +940,7 @@ public class MappingMongoConverterUnitTests { assertSyntheticFieldValueOf(outer.inner, outer); } - /** - * @see DATAMONGO-458 - */ - @Test + @Test // DATAMONGO-458 public void readEmptyCollectionIsModifiable() { DBObject dbObject = new BasicDBObject("contactsSet", new BasicDBList()); @@ -1085,10 +950,7 @@ public class MappingMongoConverterUnitTests { wrapper.contactsSet.add(new Contact() {}); } - /** - * @see DATAMONGO-424 - */ - @Test + @Test // DATAMONGO-424 public void readsPlainDBRefObject() { DBRef dbRef = new DBRef("foo", 2); @@ -1098,10 +960,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.ref, is(dbRef)); } - /** - * @see DATAMONGO-424 - */ - @Test + @Test // DATAMONGO-424 public void readsCollectionOfDBRefs() { DBRef dbRef = new DBRef("foo", 2); @@ -1115,10 +974,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.refs, hasItem(dbRef)); } - /** - * @see DATAMONGO-424 - */ - @Test + @Test // DATAMONGO-424 public void readsDBRefMap() { DBRef dbRef = mock(DBRef.class); @@ -1131,10 +987,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.refMap.values(), hasItem(dbRef)); } - /** - * @see DATAMONGO-424 - */ - @Test + @Test // DATAMONGO-424 @SuppressWarnings({ "rawtypes", "unchecked" }) public void resolvesDBRefMapValue() { @@ -1152,10 +1005,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.personMap.values(), hasItem(isPerson)); } - /** - * @see DATAMONGO-462 - */ - @Test + @Test // DATAMONGO-462 public void writesURLsAsStringOutOfTheBox() throws Exception { URLWrapper wrapper = new URLWrapper(); @@ -1167,20 +1017,14 @@ public class MappingMongoConverterUnitTests { assertThat(sink.get("url"), is((Object) "http://springsource.org")); } - /** - * @see DATAMONGO-462 - */ - @Test + @Test // DATAMONGO-462 public void readsURLFromStringOutOfTheBox() throws Exception { DBObject dbObject = new BasicDBObject("url", "http://springsource.org"); URLWrapper result = converter.read(URLWrapper.class, dbObject); assertThat(result.url, is(new URL("http://springsource.org"))); } - /** - * @see DATAMONGO-485 - */ - @Test + @Test // DATAMONGO-485 public void writesComplexIdCorrectly() { ComplexId id = new ComplexId(); @@ -1198,10 +1042,7 @@ public class MappingMongoConverterUnitTests { assertThat(((DBObject) idField).get("innerId"), is((Object) 4711L)); } - /** - * @see DATAMONGO-485 - */ - @Test + @Test // DATAMONGO-485 public void readsComplexIdCorrectly() { DBObject innerId = new BasicDBObject("innerId", 4711L); @@ -1213,10 +1054,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.complexId.innerId, is(4711L)); } - /** - * @see DATAMONGO-489 - */ - @Test + @Test // DATAMONGO-489 public void readsArraysAsMapValuesCorrectly() { BasicDBList list = new BasicDBList(); @@ -1234,10 +1072,7 @@ public class MappingMongoConverterUnitTests { assertThat(values, is(arrayWithSize(2))); } - /** - * @see DATAMONGO-497 - */ - @Test + @Test // DATAMONGO-497 public void readsEmptyCollectionIntoConstructorCorrectly() { DBObject source = new BasicDBObject("attributes", new BasicDBList()); @@ -1260,10 +1095,7 @@ public class MappingMongoConverterUnitTests { fail(String.format("Didn't find synthetic field on %s!", target)); } - /** - * @see DATAMGONGO-508 - */ - @Test + @Test // DATAMGONGO-508 public void eagerlyReturnsDBRefObjectIfTargetAlreadyIsOne() { DBRef dbRef = new DBRef("collection", "id"); @@ -1273,10 +1105,7 @@ public class MappingMongoConverterUnitTests { assertThat(converter.createDBRef(dbRef, property), is(dbRef)); } - /** - * @see DATAMONGO-523 - */ - @Test + @Test // DATAMONGO-523 public void considersTypeAliasAnnotation() { Aliased aliased = new Aliased(); @@ -1290,10 +1119,7 @@ public class MappingMongoConverterUnitTests { assertThat(type.toString(), is("_")); } - /** - * @see DATAMONGO-533 - */ - @Test + @Test // DATAMONGO-533 public void marshalsThrowableCorrectly() { ThrowableWrapper wrapper = new ThrowableWrapper(); @@ -1303,10 +1129,7 @@ public class MappingMongoConverterUnitTests { converter.write(wrapper, dbObject); } - /** - * @see DATAMONGO-592 - */ - @Test + @Test // DATAMONGO-592 public void recursivelyConvertsSpELReadValue() { DBObject input = (DBObject) JSON @@ -1315,10 +1138,7 @@ public class MappingMongoConverterUnitTests { converter.read(ObjectContainer.class, input); } - /** - * @see DATAMONGO-724 - */ - @Test + @Test // DATAMONGO-724 @SuppressWarnings("unchecked") public void mappingConsidersCustomConvertersNotWritingTypeInformation() { @@ -1376,20 +1196,14 @@ public class MappingMongoConverterUnitTests { assertThat(((Person) value).lastname, is("converter")); } - /** - * @see DATAMONGO-743 - */ - @Test + @Test // DATAMONGO-743 public void readsIntoStringsOutOfTheBox() { DBObject dbObject = new BasicDBObject("firstname", "Dave"); assertThat(converter.read(String.class, dbObject), is("{ \"firstname\" : \"Dave\"}")); } - /** - * @see DATAMONGO-766 - */ - @Test + @Test // DATAMONGO-766 public void writesProjectingTypeCorrectly() { NestedType nested = new NestedType(); @@ -1409,11 +1223,7 @@ public class MappingMongoConverterUnitTests { assertThat(aValue.get("c"), is((Object) "C")); } - /** - * @see DATAMONGO-812 - * @see DATAMONGO-893 - */ - @Test + @Test // DATAMONGO-812, DATAMONGO-893 public void convertsListToBasicDBListAndRetainsTypeInformationForComplexObjects() { Address address = new Address(); @@ -1430,10 +1240,7 @@ public class MappingMongoConverterUnitTests { assertThat(getTypedValue(getAsDBObject(dbList, 0), "_class", String.class), equalTo(Address.class.getName())); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void convertsListToBasicDBListWithoutTypeInformationForSimpleTypes() { Object result = converter.convertToMongoType(Collections.singletonList("foo")); @@ -1445,10 +1252,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbList.get(0), instanceOf(String.class)); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void convertsArrayToBasicDBListAndRetainsTypeInformationForComplexObjects() { Address address = new Address(); @@ -1464,10 +1268,7 @@ public class MappingMongoConverterUnitTests { assertThat(getTypedValue(getAsDBObject(dbList, 0), "_class", String.class), equalTo(Address.class.getName())); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void convertsArrayToBasicDBListWithoutTypeInformationForSimpleTypes() { Object result = converter.convertToMongoType(new String[] { "foo" }); @@ -1479,10 +1280,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbList.get(0), instanceOf(String.class)); } - /** - * @see DATAMONGO-833 - */ - @Test + @Test // DATAMONGO-833 public void readsEnumSetCorrectly() { BasicDBList enumSet = new BasicDBList(); @@ -1496,10 +1294,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.enumSet, hasItem(SampleEnum.SECOND)); } - /** - * @see DATAMONGO-833 - */ - @Test + @Test // DATAMONGO-833 public void readsEnumMapCorrectly() { BasicDBObject enumMap = new BasicDBObject("FIRST", "Dave"); @@ -1510,10 +1305,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.enumMap.get(SampleEnum.FIRST), is("Dave")); } - /** - * @see DATAMONGO-887 - */ - @Test + @Test // DATAMONGO-887 public void readsTreeMapCorrectly() { DBObject person = new BasicDBObject("foo", "Dave"); @@ -1527,10 +1319,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.treeMapOfPersons.get("key").firstname, is("Dave")); } - /** - * @see DATAMONGO-887 - */ - @Test + @Test // DATAMONGO-887 public void writesTreeMapCorrectly() { Person person = new Person(); @@ -1549,10 +1338,7 @@ public class MappingMongoConverterUnitTests { assertThat(entry.get("foo"), is((Object) "Dave")); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldWriteEntityWithGeoBoxCorrectly() { ClassWithGeoBox object = new ClassWithGeoBox(); @@ -1571,10 +1357,7 @@ public class MappingMongoConverterUnitTests { return new BasicDBObject("x", point.getX()).append("y", point.getY()); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldReadEntityWithGeoBoxCorrectly() { ClassWithGeoBox object = new ClassWithGeoBox(); @@ -1589,10 +1372,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.box, is(object.box)); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldWriteEntityWithGeoPolygonCorrectly() { ClassWithGeoPolygon object = new ClassWithGeoPolygon(); @@ -1614,10 +1394,7 @@ public class MappingMongoConverterUnitTests { toDbObject(object.polygon.getPoints().get(1)), toDbObject(object.polygon.getPoints().get(2)))); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldReadEntityWithGeoPolygonCorrectly() { ClassWithGeoPolygon object = new ClassWithGeoPolygon(); @@ -1632,10 +1409,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.polygon, is(object.polygon)); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldWriteEntityWithGeoCircleCorrectly() { ClassWithGeoCircle object = new ClassWithGeoCircle(); @@ -1655,10 +1429,7 @@ public class MappingMongoConverterUnitTests { radius.getMetric().toString()))); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldReadEntityWithGeoCircleCorrectly() { ClassWithGeoCircle object = new ClassWithGeoCircle(); @@ -1673,10 +1444,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.circle, is(result.circle)); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldWriteEntityWithGeoSphereCorrectly() { ClassWithGeoSphere object = new ClassWithGeoSphere(); @@ -1696,10 +1464,7 @@ public class MappingMongoConverterUnitTests { radius.getMetric().toString()))); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldWriteEntityWithGeoSphereWithMetricDistanceCorrectly() { ClassWithGeoSphere object = new ClassWithGeoSphere(); @@ -1719,10 +1484,7 @@ public class MappingMongoConverterUnitTests { radius.getMetric().toString()))); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldReadEntityWithGeoSphereCorrectly() { ClassWithGeoSphere object = new ClassWithGeoSphere(); @@ -1737,10 +1499,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.sphere, is(object.sphere)); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void shouldWriteEntityWithGeoShapeCorrectly() { ClassWithGeoShape object = new ClassWithGeoShape(); @@ -1760,10 +1519,7 @@ public class MappingMongoConverterUnitTests { radius.getMetric().toString()))); } - /** - * @DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 @Ignore public void shouldReadEntityWithGeoShapeCorrectly() { @@ -1780,10 +1536,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.shape, is((Shape) sphere)); } - /** - * @see DATAMONGO-976 - */ - @Test + @Test // DATAMONGO-976 public void shouldIgnoreTextScorePropertyWhenWriting() { ClassWithTextScoreProperty source = new ClassWithTextScoreProperty(); @@ -1795,10 +1548,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbo.get("score"), nullValue()); } - /** - * @see DATAMONGO-976 - */ - @Test + @Test // DATAMONGO-976 public void shouldIncludeTextScorePropertyWhenReading() { ClassWithTextScoreProperty entity = converter @@ -1806,10 +1556,7 @@ public class MappingMongoConverterUnitTests { assertThat(entity.score, equalTo(5F)); } - /** - * @see DATAMONGO-1001 - */ - @Test + @Test // DATAMONGO-1001 public void shouldWriteCglibProxiedClassTypeInformationCorrectly() { ProxyFactory factory = new ProxyFactory(); @@ -1823,10 +1570,7 @@ public class MappingMongoConverterUnitTests { assertThat(dbo.get("_class"), is((Object) GenericType.class.getName())); } - /** - * @see DATAMONGO-1001 - */ - @Test + @Test // DATAMONGO-1001 public void shouldUseTargetObjectOfLazyLoadingProxyWhenWriting() { LazyLoadingProxy mock = mock(LazyLoadingProxy.class); @@ -1837,10 +1581,7 @@ public class MappingMongoConverterUnitTests { verify(mock, times(1)).getTarget(); } - /** - * @see DATAMONGO-1034 - */ - @Test + @Test // DATAMONGO-1034 public void rejectsBasicDbListToBeConvertedIntoComplexType() { BasicDBList inner = new BasicDBList(); @@ -1860,10 +1601,7 @@ public class MappingMongoConverterUnitTests { converter.read(Item.class, source); } - /** - * @see DATAMONGO-1058 - */ - @Test + @Test // DATAMONGO-1058 public void readShouldRespectExplicitFieldNameForDbRef() { BasicDBObject source = new BasicDBObject(); @@ -1875,10 +1613,7 @@ public class MappingMongoConverterUnitTests { Mockito.any(DbRefResolverCallback.class), Mockito.any(DbRefProxyHandler.class)); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void writeShouldUseExplicitFieldnameForIdPropertyWhenAnnotated() { RootForClassWithExplicitlyRenamedIdField source = new RootForClassWithExplicitlyRenamedIdField(); @@ -1893,10 +1628,7 @@ public class MappingMongoConverterUnitTests { assertThat((DBObject) sink.get("nested"), is(new BasicDBObjectBuilder().add("id", "nestedId").get())); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void readShouldUseExplicitFieldnameForIdPropertyWhenAnnotated() { DBObject source = new BasicDBObjectBuilder().add("_id", "rootId") @@ -1910,10 +1642,7 @@ public class MappingMongoConverterUnitTests { assertThat(sink.nested.id, is("nestedId")); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void namedIdFieldShouldExtractValueFromUnderscoreIdField() { DBObject dbo = new BasicDBObjectBuilder().add("_id", "A").add("id", "B").get(); @@ -1923,10 +1652,7 @@ public class MappingMongoConverterUnitTests { assertThat(withNamedIdField.id, is("A")); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void explicitlyRenamedIfFieldShouldExtractValueFromIdField() { DBObject dbo = new BasicDBObjectBuilder().add("_id", "A").add("id", "B").get(); @@ -1937,10 +1663,7 @@ public class MappingMongoConverterUnitTests { assertThat(withExplicitlyRenamedField.id, is("B")); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void annotatedIdFieldShouldExtractValueFromUnderscoreIdField() { DBObject dbo = new BasicDBObjectBuilder().add("_id", "A").add("id", "B").get(); @@ -1950,10 +1673,7 @@ public class MappingMongoConverterUnitTests { assertThat(withAnnotatedIdField.key, is("A")); } - /** - * @see DATAMONGO-1102 - */ - @Test + @Test // DATAMONGO-1102 public void convertsJava8DateTimeTypesToDateAndBack() { TypeWithLocalDateTime source = new TypeWithLocalDateTime(); @@ -1966,10 +1686,7 @@ public class MappingMongoConverterUnitTests { assertThat(converter.read(TypeWithLocalDateTime.class, result).date, is(reference)); } - /** - * @see DATAMONGO-1128 - */ - @Test + @Test // DATAMONGO-1128 public void writesOptionalsCorrectly() { TypeWithOptional type = new TypeWithOptional(); @@ -1985,10 +1702,7 @@ public class MappingMongoConverterUnitTests { assertThat(localDateTime.get("value"), is(instanceOf(Date.class))); } - /** - * @see DATAMONGO-1128 - */ - @Test + @Test // DATAMONGO-1128 public void readsOptionalsCorrectly() { LocalDateTime now = LocalDateTime.now(); @@ -2003,10 +1717,7 @@ public class MappingMongoConverterUnitTests { assertThat(read.localDateTime, is(Optional.of(now))); } - /** - * @see DATAMONGO-1118 - */ - @Test + @Test // DATAMONGO-1118 @SuppressWarnings("unchecked") public void convertsMapKeyUsingCustomConverterForAndBackwards() { @@ -2025,10 +1736,7 @@ public class MappingMongoConverterUnitTests { assertThat(converter.read(ClassWithMapUsingEnumAsKey.class, target).map, is(source.map)); } - /** - * @see DATAMONGO-1118 - */ - @Test + @Test // DATAMONGO-1118 public void writesMapKeyUsingCustomConverter() { MappingMongoConverter converter = new MappingMongoConverter(resolver, mappingContext); @@ -2049,10 +1757,7 @@ public class MappingMongoConverterUnitTests { assertThat(map.containsField("bar-enum-value"), is(true)); } - /** - * @see DATAMONGO-1118 - */ - @Test + @Test // DATAMONGO-1118 public void readsMapKeyUsingCustomConverter() { MappingMongoConverter converter = new MappingMongoConverter(resolver, mappingContext); @@ -2066,18 +1771,12 @@ public class MappingMongoConverterUnitTests { assertThat(target.map.get(FooBarEnum.FOO), is("spring")); } - /** - * @see DATAMONGO-1471 - */ - @Test + @Test // DATAMONGO-1471 public void readsDocumentWithPrimitiveIdButNoValue() { assertThat(converter.read(ClassWithIntId.class, new BasicDBObject()), is(notNullValue())); } - /** - * @see DATAMONGO-1497 - */ - @Test + @Test // DATAMONGO-1497 public void readsPropertyFromNestedFieldCorrectly() { DBObject source = new BasicDBObject("nested", new BasicDBObject("sample", "value")); @@ -2086,10 +1785,7 @@ public class MappingMongoConverterUnitTests { assertThat(result.sample, is("value")); } - /** - * @see DATAMONGO-1525 - */ - @Test + @Test // DATAMONGO-1525 public void readsEmptyEnumSet() { DBObject source = new BasicDBObject("enumSet", new BasicDBList()); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoConvertersUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoConvertersUnitTests.java index 32e70e792..407e7081e 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoConvertersUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoConvertersUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 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. @@ -61,10 +61,7 @@ public class MongoConvertersUnitTests { assertThat(reference, is(bigDecimal)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsBoxToDbObjectAndBackCorrectly() { Box box = new Box(new Point(1, 2), new Point(3, 4)); @@ -75,10 +72,7 @@ public class MongoConvertersUnitTests { assertThat(shape, is((org.springframework.data.geo.Shape) box)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsCircleToDbObjectAndBackCorrectly() { Circle circle = new Circle(new Point(1, 2), 3); @@ -89,10 +83,7 @@ public class MongoConvertersUnitTests { assertThat(shape, is((org.springframework.data.geo.Shape) circle)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsPolygonToDbObjectAndBackCorrectly() { Polygon polygon = new Polygon(new Point(1, 2), new Point(2, 3), new Point(3, 4), new Point(5, 6)); @@ -103,10 +94,7 @@ public class MongoConvertersUnitTests { assertThat(shape, is((org.springframework.data.geo.Shape) polygon)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsSphereToDbObjectAndBackCorrectly() { Sphere sphere = new Sphere(new Point(1, 2), 3); @@ -117,10 +105,7 @@ public class MongoConvertersUnitTests { assertThat(shape, is((org.springframework.data.geo.Shape) sphere)); } - /** - * @see DATAMONGO-858 - */ - @Test + @Test // DATAMONGO-858 public void convertsPointToListAndBackCorrectly() { Point point = new Point(1, 2); @@ -131,50 +116,32 @@ public class MongoConvertersUnitTests { assertThat(converted, is((org.springframework.data.geo.Point) point)); } - /** - * @see DATAMONGO-1372 - */ - @Test + @Test // DATAMONGO-1372 public void convertsCurrencyToStringCorrectly() { assertThat(CurrencyToStringConverter.INSTANCE.convert(Currency.getInstance("USD")), is("USD")); } - /** - * @see DATAMONGO-1372 - */ - @Test + @Test // DATAMONGO-1372 public void convertsStringToCurrencyCorrectly() { assertThat(StringToCurrencyConverter.INSTANCE.convert("USD"), is(Currency.getInstance("USD"))); } - /** - * @see DATAMONGO-1416 - */ - @Test + @Test // DATAMONGO-1416 public void convertsAtomicLongToLongCorrectly() { assertThat(AtomicLongToLongConverter.INSTANCE.convert(new AtomicLong(100L)), is(100L)); } - /** - * @see DATAMONGO-1416 - */ - @Test + @Test // DATAMONGO-1416 public void convertsAtomicIntegerToIntegerCorrectly() { assertThat(AtomicIntegerToIntegerConverter.INSTANCE.convert(new AtomicInteger(100)), is(100)); } - /** - * @see DATAMONGO-1416 - */ - @Test + @Test // DATAMONGO-1416 public void convertsLongToAtomicLongCorrectly() { assertThat(LongToAtomicLongConverter.INSTANCE.convert(100L), is(instanceOf(AtomicLong.class))); } - /** - * @see DATAMONGO-1416 - */ - @Test + @Test // DATAMONGO-1416 public void convertsIntegerToAtomicIntegerCorrectly() { assertThat(IntegerToAtomicIntegerConverter.INSTANCE.convert(100), is(instanceOf(AtomicInteger.class))); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoExampleMapperUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoExampleMapperUnitTests.java index db4b2a4c8..b95f77a07 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoExampleMapperUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MongoExampleMapperUnitTests.java @@ -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. @@ -76,10 +76,7 @@ public class MongoExampleMapperUnitTests { this.mapper = new MongoExampleMapper(converter); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenIdIsSet() { FlatDocument probe = new FlatDocument(); @@ -90,10 +87,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(of(probe), context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenMultipleValuesSet() { FlatDocument probe = new FlatDocument(); @@ -109,10 +103,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(of(probe), context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenIdIsNotSet() { FlatDocument probe = new FlatDocument(); @@ -126,10 +117,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(of(probe), context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenListHasValues() { FlatDocument probe = new FlatDocument(); @@ -144,10 +132,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(of(probe), context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenFieldNameIsCustomized() { FlatDocument probe = new FlatDocument(); @@ -158,10 +143,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(of(probe), context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void typedExampleShouldContainTypeRestriction() { WrapperDocument probe = new WrapperDocument(); @@ -174,10 +156,7 @@ public class MongoExampleMapperUnitTests { isBsonObject().containing("_class", new BasicDBObject("$in", new String[] { probe.getClass().getName() }))); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedAsFlatMapWhenGivenNestedElementsWithLenientMatchMode() { WrapperDocument probe = new WrapperDocument(); @@ -189,10 +168,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(of(probe), context.getPersistentEntity(WrapperDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedAsExactObjectWhenGivenNestedElementsWithStrictMatchMode() { WrapperDocument probe = new WrapperDocument(); @@ -205,10 +181,7 @@ public class MongoExampleMapperUnitTests { isBsonObject().containing("flatDoc.stringValue", "conflux")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenStringMatchModeIsStarting() { FlatDocument probe = new FlatDocument(); @@ -224,10 +197,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeContainingDotsWhenStringMatchModeIsStarting() { FlatDocument probe = new FlatDocument(); @@ -243,10 +213,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenStringMatchModeIsEnding() { FlatDocument probe = new FlatDocument(); @@ -262,10 +229,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenStringMatchModeRegex() { FlatDocument probe = new FlatDocument(); @@ -281,10 +245,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenIgnoreCaseEnabledAndMatchModeSet() { FlatDocument probe = new FlatDocument(); @@ -300,10 +261,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyForFlatTypeWhenIgnoreCaseEnabled() { FlatDocument probe = new FlatDocument(); @@ -319,10 +277,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedWhenContainingDBRef() { FlatDocument probe = new FlatDocument(); @@ -337,10 +292,7 @@ public class MongoExampleMapperUnitTests { assertThat(reference.getCollectionName(), is("refDoc")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedWhenDBRefIsNull() { FlatDocument probe = new FlatDocument(); @@ -351,10 +303,7 @@ public class MongoExampleMapperUnitTests { assertThat(dbo, isBsonObject().containing("stringValue", "steelheart")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyWhenContainingLegacyPoint() { ClassWithGeoTypes probe = new ClassWithGeoTypes(); @@ -366,10 +315,7 @@ public class MongoExampleMapperUnitTests { assertThat(dbo.get("legacyPoint.y"), Is.is(20D)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void mappingShouldExcludeFieldWithCustomNameCorrectly() { FlatDocument probe = new FlatDocument(); @@ -386,10 +332,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void mappingShouldExcludeFieldCorrectly() { FlatDocument probe = new FlatDocument(); @@ -406,10 +349,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void mappingShouldExcludeNestedFieldCorrectly() { WrapperDocument probe = new WrapperDocument(); @@ -427,10 +367,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(WrapperDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void mappingShouldExcludeNestedFieldWithCustomNameCorrectly() { WrapperDocument probe = new WrapperDocument(); @@ -448,10 +385,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(WrapperDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void mappingShouldFavorFieldSpecificationStringMatcherOverDefaultStringMatcher() { FlatDocument probe = new FlatDocument(); @@ -467,10 +401,7 @@ public class MongoExampleMapperUnitTests { assertThat(mapper.getMappedExample(example, context.getPersistentEntity(FlatDocument.class)), is(expected)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void mappingShouldIncludePropertiesFromHierarchicalDocument() { HierachicalDocument probe = new HierachicalDocument(); @@ -483,10 +414,7 @@ public class MongoExampleMapperUnitTests { assertThat(dbo, isBsonObject().containing("anotherStringValue", "calamity")); } - /** - * @see DATAMONGO-1459 - */ - @Test + @Test // DATAMONGO-1459 public void mapsAnyMatchingExampleCorrectly() { FlatDocument probe = new FlatDocument(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NamedMongoScriptConvertsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NamedMongoScriptConvertsUnitTests.java index c7acd2f0f..1dedb52ec 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NamedMongoScriptConvertsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NamedMongoScriptConvertsUnitTests.java @@ -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,18 +58,12 @@ public class NamedMongoScriptConvertsUnitTests { NamedMongoScriptToDBObjectConverter converter = NamedMongoScriptToDBObjectConverter.INSTANCE; - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void convertShouldReturnEmptyDboWhenScriptIsNull() { assertThat(converter.convert(null), is((DBObject) new BasicDBObject())); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void convertShouldConvertScriptNameCorreclty() { DBObject dbo = converter.convert(ECHO_SCRIPT); @@ -79,10 +73,7 @@ public class NamedMongoScriptConvertsUnitTests { assertThat(id, is((Object) FUNCTION_NAME)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void convertShouldConvertScriptCodeCorreclty() { DBObject dbo = converter.convert(ECHO_SCRIPT); @@ -100,18 +91,12 @@ public class NamedMongoScriptConvertsUnitTests { DBObjectToNamedMongoScriptCoverter converter = DBObjectToNamedMongoScriptCoverter.INSTANCE; - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void convertShouldReturnNullIfSourceIsNull() { assertThat(converter.convert(null), is(nullValue())); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void convertShouldConvertIdCorreclty() { NamedMongoScript script = converter.convert(FUNCTION); @@ -119,10 +104,7 @@ public class NamedMongoScriptConvertsUnitTests { assertThat(script.getName(), is(FUNCTION_NAME)); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void convertShouldConvertScriptValueCorreclty() { NamedMongoScript script = converter.convert(FUNCTION); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NumberToNumberConverterFactoryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NumberToNumberConverterFactoryUnitTests.java index efce959f5..8b7c70245 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NumberToNumberConverterFactoryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/NumberToNumberConverterFactoryUnitTests.java @@ -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. @@ -52,10 +52,7 @@ public class NumberToNumberConverterFactoryUnitTests { return Arrays. asList(longToInt, atomicIntToInt, atomicIntToDouble, atomicLongToInt, atomicLongToLong); } - /** - * @see DATAMONGO-1288 - */ - @Test + @Test // DATAMONGO-1288 public void convertsToTargetTypeCorrectly() { assertThat(NumberToNumberConverterFactory.INSTANCE.getConverter(expected.getClass()).convert(source), is(expected)); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/QueryMapperUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/QueryMapperUnitTests.java index 585ed114b..0b515a3a6 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/QueryMapperUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/QueryMapperUnitTests.java @@ -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. @@ -128,10 +128,7 @@ public class QueryMapperUnitTests { assertThat(result.get("_id"), is((Object) id)); } - /** - * @see DATAMONGO-278 - */ - @Test + @Test // DATAMONGO-278 public void translates$NeCorrectly() { Criteria criteria = where("foo").ne(new ObjectId().toString()); @@ -143,10 +140,7 @@ public class QueryMapperUnitTests { assertThat(dbObject.get("$ne"), is(instanceOf(ObjectId.class))); } - /** - * @see DATAMONGO-326 - */ - @Test + @Test // DATAMONGO-326 public void handlesEnumsCorrectly() { Query query = query(where("foo").is(Enum.INSTANCE)); DBObject result = mapper.getMappedObject(query.getQueryObject(), null); @@ -186,20 +180,14 @@ public class QueryMapperUnitTests { assertThat(list.get(0).toString(), is(Enum.INSTANCE.name())); } - /** - * @see DATAMONGO-373 - */ - @Test + @Test // DATAMONGO-373 public void handlesNativelyBuiltQueryCorrectly() { DBObject query = new QueryBuilder().or(new BasicDBObject("foo", "bar")).get(); mapper.getMappedObject(query, null); } - /** - * @see DATAMONGO-369 - */ - @Test + @Test // DATAMONGO-369 public void handlesAllPropertiesIfDBObject() { DBObject query = new BasicDBObject(); @@ -210,10 +198,7 @@ public class QueryMapperUnitTests { assertThat(result.get("bar"), is(notNullValue())); } - /** - * @see DATAMONGO-429 - */ - @Test + @Test // DATAMONGO-429 public void transformsArraysCorrectly() { Query query = new BasicQuery("{ 'tags' : { '$all' : [ 'green', 'orange']}}"); @@ -235,10 +220,7 @@ public class QueryMapperUnitTests { assertThat(((DBObject) result.get("nested")).get("_id"), is(instanceOf(ObjectId.class))); } - /** - * @see DATAMONGO-493 - */ - @Test + @Test // DATAMONGO-493 public void doesNotTranslateNonIdPropertiesFor$NeCriteria() { ObjectId accidentallyAnObjectId = new ObjectId(); @@ -254,10 +236,7 @@ public class QueryMapperUnitTests { assertThat(publishers.get("$ne"), is(instanceOf(String.class))); } - /** - * @see DATAMONGO-494 - */ - @Test + @Test // DATAMONGO-494 public void usesEntityMetadataInOr() { Query query = query(new Criteria().orOperator(where("foo").is("bar"))); @@ -356,10 +335,7 @@ public class QueryMapperUnitTests { assertThat(inClause.get(1), is(instanceOf(com.mongodb.DBRef.class))); } - /** - * @see DATAMONGO-570 - */ - @Test + @Test // DATAMONGO-570 public void correctlyConvertsNullReference() { Query query = query(where("reference").is(null)); @@ -368,10 +344,7 @@ public class QueryMapperUnitTests { assertThat(object.get("reference"), is(nullValue())); } - /** - * @see DATAMONGO-629 - */ - @Test + @Test // DATAMONGO-629 public void doesNotMapIdIfNoEntityMetadataAvailable() { String id = new ObjectId().toString(); @@ -384,10 +357,7 @@ public class QueryMapperUnitTests { assertThat(object.containsField("_id"), is(false)); } - /** - * @see DATAMONGO-677 - */ - @Test + @Test // DATAMONGO-677 public void handleMapWithDBRefCorrectly() { DBObject mapDbObject = new BasicDBObject(); @@ -413,10 +383,7 @@ public class QueryMapperUnitTests { assertThat(mapped.get("_id"), is(instanceOf(ObjectId.class))); } - /** - * @see DATAMONGO-705 - */ - @Test + @Test // DATAMONGO-705 public void convertsDBRefWithExistsQuery() { Query query = query(where("reference").exists(false)); @@ -429,10 +396,7 @@ public class QueryMapperUnitTests { assertThat(reference.get("$exists"), is((Object) false)); } - /** - * @see DATAMONGO-706 - */ - @Test + @Test // DATAMONGO-706 public void convertsNestedDBRefsCorrectly() { Reference reference = new Reference(); @@ -453,10 +417,7 @@ public class QueryMapperUnitTests { assertThat(inClause.get(0), is(instanceOf(com.mongodb.DBRef.class))); } - /** - * @see DATAMONGO-752 - */ - @Test + @Test // DATAMONGO-752 public void mapsSimpleValuesStartingWith$Correctly() { Query query = query(where("myvalue").is("$334")); @@ -467,10 +428,7 @@ public class QueryMapperUnitTests { assertThat(result.get("myvalue"), is((Object) "$334")); } - /** - * @see DATAMONGO-752 - */ - @Test + @Test // DATAMONGO-752 public void mapsKeywordAsSimpleValuesCorrectly() { Query query = query(where("myvalue").is("$center")); @@ -481,10 +439,7 @@ public class QueryMapperUnitTests { assertThat(result.get("myvalue"), is((Object) "$center")); } - /** - * @DATAMONGO-805 - */ - @Test + @Test // DATAMONGO-805 public void shouldExcludeDBRefAssociation() { Query query = query(where("someString").is("foo")); @@ -498,10 +453,7 @@ public class QueryMapperUnitTests { assertThat(fieldsResult.get("reference"), is((Object) 0)); } - /** - * @see DATAMONGO-686 - */ - @Test + @Test // DATAMONGO-686 public void queryMapperShouldNotChangeStateInGivenQueryObjectWhenIdConstrainedByInList() { BasicMongoPersistentEntity persistentEntity = context.getPersistentEntity(Sample.class); @@ -515,10 +467,7 @@ public class QueryMapperUnitTests { assertThat(idValuesAfter, is(idValuesBefore)); } - /** - * @see DATAMONGO-821 - */ - @Test + @Test // DATAMONGO-821 public void queryMapperShouldNotTryToMapDBRefListPropertyIfNestedInsideDBObjectWithinDBObject() { DBObject queryObject = query( @@ -531,10 +480,7 @@ public class QueryMapperUnitTests { assertThat(nestedObject, is((DBObject) new BasicDBObject("$keys", 0L))); } - /** - * @see DATAMONGO-821 - */ - @Test + @Test // DATAMONGO-821 public void queryMapperShouldNotTryToMapDBRefPropertyIfNestedInsideDBObjectWithinDBObject() { DBObject queryObject = query(where("reference").is(new BasicDBObject("$nested", new BasicDBObject("$keys", 0L)))) @@ -547,10 +493,7 @@ public class QueryMapperUnitTests { assertThat(nestedObject, is((DBObject) new BasicDBObject("$keys", 0L))); } - /** - * @see DATAMONGO-821 - */ - @Test + @Test // DATAMONGO-821 public void queryMapperShouldMapDBRefPropertyIfNestedInDBObject() { Reference sample = new Reference(); @@ -566,10 +509,7 @@ public class QueryMapperUnitTests { assertThat(inObject.get(0), is(instanceOf(com.mongodb.DBRef.class))); } - /** - * @see DATAMONGO-773 - */ - @Test + @Test // DATAMONGO-773 public void queryMapperShouldBeAbleToProcessQueriesThatIncludeDbRefFields() { BasicMongoPersistentEntity persistentEntity = context.getPersistentEntity(WithDBRef.class); @@ -581,10 +521,7 @@ public class QueryMapperUnitTests { assertThat(mappedFields, is(notNullValue())); } - /** - * @see DATAMONGO-893 - */ - @Test + @Test // DATAMONGO-893 public void classInformationShouldNotBePresentInDBObjectUsedInFinderMethods() { EmbeddedClass embedded = new EmbeddedClass(); @@ -598,10 +535,7 @@ public class QueryMapperUnitTests { assertThat(dbo.toString(), equalTo("{ \"embedded\" : { \"$in\" : [ { \"_id\" : \"1\"} , { \"_id\" : \"2\"}]}}")); } - /** - * @see DATAMONGO-1406 - */ - @Test + @Test // DATAMONGO-1406 public void shouldMapQueryForNestedCustomizedPropertiesUsingConfiguredFieldNames() { EmbeddedClass embeddedClass = new EmbeddedClass(); @@ -620,10 +554,7 @@ public class QueryMapperUnitTests { new BasicDbListBuilder().add(new BasicDBObject("fancy_custom_name", embeddedClass.customizedField)).get())); } - /** - * @see DATAMONGO-647 - */ - @Test + @Test // DATAMONGO-647 public void customizedFieldNameShouldBeMappedCorrectlyWhenApplyingSort() { Query query = query(where("field").is("bar")).with(new Sort(Direction.DESC, "field")); @@ -631,10 +562,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("foo", -1).get())); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void getMappedFieldsAppendsTextScoreFieldProperlyCorrectlyWhenNotPresent() { Query query = new Query(); @@ -645,10 +573,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("score", new BasicDBObject("$meta", "textScore")).get())); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void getMappedFieldsReplacesTextScoreFieldProperlyCorrectlyWhenPresent() { Query query = new Query(); @@ -660,10 +585,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("score", new BasicDBObject("$meta", "textScore")).get())); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void getMappedSortAppendsTextScoreProperlyWhenSortedByScore() { Query query = new Query().with(new Sort("textScore")); @@ -674,10 +596,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("score", new BasicDBObject("$meta", "textScore")).get())); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void getMappedSortIgnoresTextScoreWhenNotSortedByScore() { Query query = new Query().with(new Sort("id")); @@ -688,10 +607,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("_id", 1).get())); } - /** - * @see DATAMONGO-1070 - */ - @Test + @Test // DATAMONGO-1070 public void mapsIdReferenceToDBRefCorrectly() { ObjectId id = new ObjectId(); @@ -704,10 +620,7 @@ public class QueryMapperUnitTests { assertThat(reference.getId(), is(instanceOf(ObjectId.class))); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void shouldUseExplicitlySetFieldnameForIdPropertyCandidates() { Query query = query(where("nested.id").is("bar")); @@ -718,10 +631,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("nested.id", "bar").get())); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void shouldUseExplicitlySetFieldnameForIdPropertyCandidatesUsedInSortClause() { Query query = new Query().with(new Sort("nested.id")); @@ -732,10 +642,7 @@ public class QueryMapperUnitTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("nested.id", 1).get())); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void nearShouldUseGeoJsonRepresentationOnUnmappedProperty() { Query query = query(where("foo").near(new GeoJsonPoint(100, 50))); @@ -747,10 +654,7 @@ public class QueryMapperUnitTests { assertThat(dbo, isBsonObject().containing("foo.$near.$geometry.coordinates.[1]", 50D)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void nearShouldUseGeoJsonRepresentationWhenMappingToGoJsonType() { Query query = query(where("geoJsonPoint").near(new GeoJsonPoint(100, 50))); @@ -760,10 +664,7 @@ public class QueryMapperUnitTests { assertThat(dbo, isBsonObject().containing("geoJsonPoint.$near.$geometry.type", "Point")); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void nearSphereShouldUseGeoJsonRepresentationWhenMappingToGoJsonType() { Query query = query(where("geoJsonPoint").nearSphere(new GeoJsonPoint(100, 50))); @@ -773,10 +674,7 @@ public class QueryMapperUnitTests { assertThat(dbo, isBsonObject().containing("geoJsonPoint.$nearSphere.$geometry.type", "Point")); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void shouldMapNameCorrectlyForGeoJsonType() { Query query = query(where("namedGeoJsonPoint").nearSphere(new GeoJsonPoint(100, 50))); @@ -787,10 +685,7 @@ public class QueryMapperUnitTests { isBsonObject().containing("geoJsonPointWithNameViaFieldAnnotation.$nearSphere.$geometry.type", "Point")); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void withinShouldUseGeoJsonPolygonWhenMappingPolygonOn2DSphereIndex() { Query query = query(where("geoJsonPoint") @@ -801,10 +696,7 @@ public class QueryMapperUnitTests { assertThat(dbo, isBsonObject().containing("geoJsonPoint.$geoWithin.$geometry.type", "Polygon")); } - /** - * @see DATAMONGO-1134 - */ - @Test + @Test // DATAMONGO-1134 public void intersectsShouldUseGeoJsonRepresentationCorrectly() { Query query = query(where("geoJsonPoint") @@ -816,11 +708,7 @@ public class QueryMapperUnitTests { assertThat(dbo, isBsonObject().containing("geoJsonPoint.$geoIntersects.$geometry.coordinates")); } - /** - * - * @see DATAMONGO-1269 - */ - @Test + @Test // DATAMONGO-1269 public void mappingShouldRetainNumericMapKey() { Query query = query(where("map.1.stringProperty").is("ba'alzamon")); @@ -831,10 +719,7 @@ public class QueryMapperUnitTests { assertThat(dbo.containsField("map.1.stringProperty"), is(true)); } - /** - * @see DATAMONGO-1269 - */ - @Test + @Test // DATAMONGO-1269 public void mappingShouldRetainNumericPositionInList() { Query query = query(where("list.1.stringProperty").is("ba'alzamon")); @@ -845,10 +730,7 @@ public class QueryMapperUnitTests { assertThat(dbo.containsField("list.1.stringProperty"), is(true)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectly() { Foo probe = new Foo(); @@ -862,10 +744,7 @@ public class QueryMapperUnitTests { assertThat(dbo, isBsonObject().containing("embedded\\._id", "conflux")); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void exampleShouldBeMappedCorrectlyWhenContainingLegacyPoint() { ClassWithGeoTypes probe = new ClassWithGeoTypes(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/ReflectiveDBRefResolverUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/ReflectiveDBRefResolverUnitTests.java index 01b105540..7d0c65d8c 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/ReflectiveDBRefResolverUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/ReflectiveDBRefResolverUnitTests.java @@ -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 ReflectiveDBRefResolverUnitTests { when(collectionMock.findOne(eq("id-1"))).thenReturn(new BasicDBObject("_id", "id-1")); } - /** - * @see DATAMONGO-1193 - */ - @Test + @Test // DATAMONGO-1193 public void fetchShouldNotLookUpDbWhenUsingDriverVersion2() { assumeThat(isMongo3Driver(), is(false)); @@ -72,10 +69,7 @@ public class ReflectiveDBRefResolverUnitTests { verify(dbFactoryMock, never()).getDb(anyString()); } - /** - * @see DATAMONGO-1193 - */ - @Test + @Test // DATAMONGO-1193 public void fetchShouldUseDbToResolveDbRefWhenUsingDriverVersion3() { assumeThat(isMongo3Driver(), is(true)); @@ -84,10 +78,7 @@ public class ReflectiveDBRefResolverUnitTests { verify(dbFactoryMock, times(1)).getDb(); } - /** - * @see DATAMONGO-1193 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1193 public void fetchShouldThrowExceptionWhenDbFactoryIsNullUsingDriverVersion3() { assumeThat(isMongo3Driver(), is(true)); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/TermToStringConverterUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/TermToStringConverterUnitTests.java index c7971154d..0ce0ca4b6 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/TermToStringConverterUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/TermToStringConverterUnitTests.java @@ -29,18 +29,12 @@ import org.springframework.data.mongodb.core.query.Term.Type; */ public class TermToStringConverterUnitTests { - /** - * @DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void shouldNotConvertNull() { assertThat(TermToStringConverter.INSTANCE.convert(null), nullValue()); } - /** - * @DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void shouldUseFormattedRepresentationForConversion() { Term term = spy(new Term("foo", Type.WORD)); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/UpdateMapperUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/UpdateMapperUnitTests.java index adcfcb2cf..189ec4095 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/UpdateMapperUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/UpdateMapperUnitTests.java @@ -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. @@ -100,10 +100,7 @@ public class UpdateMapperUnitTests { this.mapper = new UpdateMapper(converter); } - /** - * @see DATAMONGO-721 - */ - @Test + @Test // DATAMONGO-721 public void updateMapperRetainsTypeInformationForCollectionField() { Update update = new Update().push("list", new ConcreteChildClass("2", "BAR")); @@ -117,10 +114,7 @@ public class UpdateMapperUnitTests { assertThat(list.get("_class"), is((Object) ConcreteChildClass.class.getName())); } - /** - * @see DATAMONGO-807 - */ - @Test + @Test // DATAMONGO-807 public void updateMapperShouldRetainTypeInformationForNestedEntities() { Update update = Update.update("model", new ModelImpl(1)); @@ -134,10 +128,7 @@ public class UpdateMapperUnitTests { assertThat(modelDbObject.get("_class"), not(nullValue())); } - /** - * @see DATAMONGO-807 - */ - @Test + @Test // DATAMONGO-807 public void updateMapperShouldNotPersistTypeInformationForKnownSimpleTypes() { Update update = Update.update("model.value", 1); @@ -150,10 +141,7 @@ public class UpdateMapperUnitTests { assertThat(set.get("_class"), nullValue()); } - /** - * @see DATAMONGO-807 - */ - @Test + @Test // DATAMONGO-807 public void updateMapperShouldNotPersistTypeInformationForNullValues() { Update update = Update.update("model", null); @@ -166,10 +154,7 @@ public class UpdateMapperUnitTests { assertThat(set.get("_class"), nullValue()); } - /** - * @see DATAMONGO-407 - */ - @Test + @Test // DATAMONGO-407 public void updateMapperShouldRetainTypeInformationForNestedCollectionElements() { Update update = Update.update("list.$", new ConcreteChildClass("42", "bubu")); @@ -183,10 +168,7 @@ public class UpdateMapperUnitTests { assertThat(modelDbObject.get("_class"), is((Object) ConcreteChildClass.class.getName())); } - /** - * @see DATAMONGO-407 - */ - @Test + @Test // DATAMONGO-407 public void updateMapperShouldSupportNestedCollectionElementUpdates() { Update update = Update.update("list.$.value", "foo").set("list.$.otherValue", "bar"); @@ -200,10 +182,7 @@ public class UpdateMapperUnitTests { assertThat(set.get("aliased.$.otherValue"), is((Object) "bar")); } - /** - * @see DATAMONGO-407 - */ - @Test + @Test // DATAMONGO-407 public void updateMapperShouldWriteTypeInformationForComplexNestedCollectionElementUpdates() { Update update = Update.update("list.$.value", "foo").set("list.$.someObject", new ConcreteChildClass("42", "bubu")); @@ -221,11 +200,8 @@ public class UpdateMapperUnitTests { assertThat(someObject.get("value"), is((Object) "bubu")); } - /** - * @see DATAMONGO-812 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test + @Test // DATAMONGO-812 public void updateMapperShouldConvertPushCorrectlyWhenCalledWithEachUsingSimpleTypes() { Update update = new Update().push("values").each("spring", "data", "mongodb"); @@ -241,10 +217,7 @@ public class UpdateMapperUnitTests { assertThat(each.toMap(), (Matcher) allOf(hasValue("spring"), hasValue("data"), hasValue("mongodb"))); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void updateMapperShouldConvertPushWhithoutAddingClassInformationWhenUsedWithEvery() { Update update = new Update().push("values").each("spring", "data", "mongodb"); @@ -257,11 +230,8 @@ public class UpdateMapperUnitTests { assertThat(values.get("_class"), nullValue()); } - /** - * @see DATAMONGO-812 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test + @Test // DATAMONGO-812 public void updateMapperShouldConvertPushCorrectlyWhenCalledWithEachUsingCustomTypes() { Update update = new Update().push("models").each(new ListModel("spring", "data", "mongodb")); @@ -276,10 +246,7 @@ public class UpdateMapperUnitTests { assertThat(values.toMap(), (Matcher) allOf(hasValue("spring"), hasValue("data"), hasValue("mongodb"))); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void updateMapperShouldRetainClassInformationForPushCorrectlyWhenCalledWithEachUsingCustomTypes() { Update update = new Update().push("models").each(new ListModel("spring", "data", "mongodb")); @@ -293,10 +260,7 @@ public class UpdateMapperUnitTests { assertThat(((DBObject) each.get(0)).get("_class").toString(), equalTo(ListModel.class.getName())); } - /** - * @see DATAMONGO-812 - */ - @Test + @Test // DATAMONGO-812 public void testUpdateShouldAllowMultiplePushEachForDifferentFields() { Update update = new Update().push("category").each("spring", "data").push("type").each("mongodb"); @@ -307,10 +271,7 @@ public class UpdateMapperUnitTests { assertThat(getAsDBObject(push, "type").containsField("$each"), is(true)); } - /** - * @see DATAMONGO-943 - */ - @Test + @Test // DATAMONGO-943 public void updatePushEachAtPositionWorksCorrectlyWhenGivenPositiveIndexParameter() { Update update = new Update().push("key").atPosition(2).each(Arrays.asList("Arya", "Arry", "Weasel")); @@ -325,10 +286,7 @@ public class UpdateMapperUnitTests { assertThat(getAsDBObject(push, "key").containsField("$each"), is(true)); } - /** - * @see DATAMONGO-943 - */ - @Test + @Test // DATAMONGO-943 public void updatePushEachAtPositionWorksCorrectlyWhenGivenPositionFirst() { Update update = new Update().push("key").atPosition(Position.FIRST).each(Arrays.asList("Arya", "Arry", "Weasel")); @@ -343,10 +301,7 @@ public class UpdateMapperUnitTests { assertThat(getAsDBObject(push, "key").containsField("$each"), is(true)); } - /** - * @see DATAMONGO-943 - */ - @Test + @Test // DATAMONGO-943 public void updatePushEachAtPositionWorksCorrectlyWhenGivenPositionLast() { Update update = new Update().push("key").atPosition(Position.LAST).each(Arrays.asList("Arya", "Arry", "Weasel")); @@ -360,10 +315,7 @@ public class UpdateMapperUnitTests { assertThat(getAsDBObject(push, "key").containsField("$each"), is(true)); } - /** - * @see DATAMONGO-943 - */ - @Test + @Test // DATAMONGO-943 public void updatePushEachAtPositionWorksCorrectlyWhenGivenPositionNull() { Update update = new Update().push("key").atPosition(null).each(Arrays.asList("Arya", "Arry", "Weasel")); @@ -377,10 +329,7 @@ public class UpdateMapperUnitTests { assertThat(getAsDBObject(push, "key").containsField("$each"), is(true)); } - /** - * @see DATAMONGO-832 - */ - @Test + @Test // DATAMONGO-832 public void updatePushEachWithSliceShouldRenderCorrectly() { Update update = new Update().push("key").slice(5).each(Arrays.asList("Arya", "Arry", "Weasel")); @@ -395,10 +344,7 @@ public class UpdateMapperUnitTests { assertThat(key.containsField("$each"), is(true)); } - /** - * @see DATAMONGO-832 - */ - @Test + @Test // DATAMONGO-832 public void updatePushEachWithSliceShouldRenderWhenUsingMultiplePushCorrectly() { Update update = new Update().push("key").slice(5).each(Arrays.asList("Arya", "Arry", "Weasel")).push("key-2") @@ -420,10 +366,7 @@ public class UpdateMapperUnitTests { assertThat(key2.containsField("$each"), is(true)); } - /** - * @see DATAMONGO-1141 - */ - @Test + @Test // DATAMONGO-1141 public void updatePushEachWithValueSortShouldRenderCorrectly() { Update update = new Update().push("scores").sort(Direction.DESC).each(42, 23, 68); @@ -439,10 +382,7 @@ public class UpdateMapperUnitTests { assertThat(key.containsField("$each"), is(true)); } - /** - * @see DATAMONGO-1141 - */ - @Test + @Test // DATAMONGO-1141 public void updatePushEachWithDocumentSortShouldRenderCorrectly() { Update update = new Update().push("list") @@ -461,10 +401,7 @@ public class UpdateMapperUnitTests { assertThat(key.containsField("$each"), is(true)); } - /** - * @see DATAMONGO-1141 - */ - @Test + @Test // DATAMONGO-1141 public void updatePushEachWithSortShouldRenderCorrectlyWhenUsingMultiplePush() { Update update = new Update().push("authors").sort(Direction.ASC).each("Harry").push("chapters") @@ -486,10 +423,7 @@ public class UpdateMapperUnitTests { assertThat(key2.containsField("$each"), is(true)); } - /** - * @see DATAMONGO-410 - */ - @Test + @Test // DATAMONGO-410 public void testUpdateMapperShouldConsiderCustomWriteTarget() { List someValues = Arrays.asList(new NestedEntity("spring"), new NestedEntity("data"), @@ -502,10 +436,7 @@ public class UpdateMapperUnitTests { verify(writingConverterSpy, times(3)).convert(Mockito.any(NestedEntity.class)); } - /** - * @see DATAMONGO-404 - */ - @Test + @Test // DATAMONGO-404 public void createsDbRefForEntityIdOnPulls() { Update update = new Update().pull("dbRefAnnotatedList.id", "2"); @@ -517,10 +448,7 @@ public class UpdateMapperUnitTests { assertThat(pullClause.get("dbRefAnnotatedList"), is((Object) new DBRef("entity", "2"))); } - /** - * @see DATAMONGO-404 - */ - @Test + @Test // DATAMONGO-404 public void createsDbRefForEntityOnPulls() { Entity entity = new Entity(); @@ -534,20 +462,14 @@ public class UpdateMapperUnitTests { assertThat(pullClause.get("dbRefAnnotatedList"), is((Object) new DBRef("entity", entity.id))); } - /** - * @see DATAMONGO-404 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-404 public void rejectsInvalidFieldReferenceForDbRef() { Update update = new Update().pull("dbRefAnnotatedList.name", "NAME"); mapper.getMappedObject(update.getUpdateObject(), context.getPersistentEntity(DocumentWithDBRefCollection.class)); } - /** - * @see DATAMONGO-404 - */ - @Test + @Test // DATAMONGO-404 public void rendersNestedDbRefCorrectly() { Update update = new Update().pull("nested.dbRefAnnotatedList.id", "2"); @@ -558,10 +480,7 @@ public class UpdateMapperUnitTests { assertThat(pullClause.containsField("mapped.dbRefAnnotatedList"), is(true)); } - /** - * @see DATAMONGO-468 - */ - @Test + @Test // DATAMONGO-468 public void rendersUpdateOfDbRefPropertyWithDomainObjectCorrectly() { Entity entity = new Entity(); @@ -575,10 +494,7 @@ public class UpdateMapperUnitTests { assertThat(setClause.get("dbRefProperty"), is((Object) new DBRef("entity", entity.id))); } - /** - * @see DATAMONGO-862 - */ - @Test + @Test // DATAMONGO-862 public void rendersUpdateAndPreservesKeyForPathsNotPointingToProperty() { Update update = new Update().set("listOfInterface.$.value", "expected-value"); @@ -589,10 +505,7 @@ public class UpdateMapperUnitTests { assertThat(setClause.containsField("listOfInterface.$.value"), is(true)); } - /** - * @see DATAMONGO-863 - */ - @Test + @Test // DATAMONGO-863 public void doesNotConvertRawDbObjects() { Update update = new Update(); @@ -610,11 +523,8 @@ public class UpdateMapperUnitTests { assertThat(inClause, IsIterableContainingInOrder. contains(1L, 2L)); } - /** - * @see DATAMONG0-471 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test + @Test // DATAMONG0-471 public void testUpdateShouldApply$addToSetCorrectlyWhenUsedWith$each() { Update update = new Update().addToSet("values").each("spring", "data", "mongodb"); @@ -628,10 +538,7 @@ public class UpdateMapperUnitTests { assertThat(each.toMap(), (Matcher) allOf(hasValue("spring"), hasValue("data"), hasValue("mongodb"))); } - /** - * @see DATAMONG0-471 - */ - @Test + @Test // DATAMONG0-471 public void testUpdateShouldRetainClassTypeInformationWhenUsing$addToSetWith$eachForCustomTypes() { Update update = new Update().addToSet("models").each(new ModelImpl(2014), new ModelImpl(1), new ModelImpl(28)); @@ -649,10 +556,7 @@ public class UpdateMapperUnitTests { } } - /** - * @see DATAMONGO-897 - */ - @Test + @Test // DATAMONGO-897 public void updateOnDbrefPropertyOfInterfaceTypeWithoutExplicitGetterForIdShouldBeMappedCorrectly() { Update update = new Update().set("referencedDocument", new InterfaceDocumentDefinitionImpl("1", "Foo")); @@ -666,10 +570,7 @@ public class UpdateMapperUnitTests { assertThat(model, allOf(instanceOf(DBRef.class), IsEqual. equalTo(expectedDBRef))); } - /** - * @see DATAMONGO-847 - */ - @Test + @Test // DATAMONGO-847 public void updateMapperConvertsNestedQueryCorrectly() { Update update = new Update().pull("list", Query.query(Criteria.where("value").in("foo", "bar"))); @@ -684,10 +585,7 @@ public class UpdateMapperUnitTests { assertThat($in, IsIterableContainingInOrder. contains("foo", "bar")); } - /** - * @see DATAMONGO-847 - */ - @Test + @Test // DATAMONGO-847 public void updateMapperConvertsPullWithNestedQuerfyOnDBRefCorrectly() { Update update = new Update().pull("dbRefAnnotatedList", Query.query(Criteria.where("id").is("1"))); @@ -700,10 +598,7 @@ public class UpdateMapperUnitTests { assertThat(list, equalTo(new BasicDBObjectBuilder().add("_id", "1").get())); } - /** - * @see DATAMONGO-1077 - */ - @Test + @Test // DATAMONGO-1077 public void shouldNotRemovePositionalParameter() { Update update = new Update(); @@ -717,10 +612,7 @@ public class UpdateMapperUnitTests { assertThat($unset, equalTo(new BasicDBObjectBuilder().add("dbRefAnnotatedList.$", 1).get())); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void mappingEachOperatorShouldNotAddTypeInfoForNonInterfaceNonAbstractTypes() { Update update = new Update().addToSet("nestedDocs").each(new NestedDocument("nested-1"), @@ -733,10 +625,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().notContaining("$addToSet.nestedDocs.$each.[1]._class")); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void mappingEachOperatorShouldAddTypeHintForInterfaceTypes() { Update update = new Update().addToSet("models").each(new ModelImpl(1), new ModelImpl(2)); @@ -748,10 +637,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().containing("$addToSet.models.$each.[1]._class", ModelImpl.class.getName())); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void mappingEachOperatorShouldAddTypeHintForAbstractTypes() { Update update = new Update().addToSet("list").each(new ConcreteChildClass("foo", "one"), @@ -766,10 +652,7 @@ public class UpdateMapperUnitTests { isBsonObject().containing("$addToSet.aliased.$each.[1]._class", ConcreteChildClass.class.getName())); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void mappingShouldOnlyRemoveTypeHintFromTopLevelTypeInCaseOfNestedDocument() { WrapperAroundInterfaceType wait = new WrapperAroundInterfaceType(); @@ -787,10 +670,7 @@ public class UpdateMapperUnitTests { ModelImpl.class.getName())); } - /** - * @see DATAMONGO-1210 - */ - @Test + @Test // DATAMONGO-1210 public void mappingShouldRetainTypeInformationOfNestedListWhenUpdatingConcreteyParentType() { ListModelWrapper lmw = new ListModelWrapper(); @@ -805,10 +685,7 @@ public class UpdateMapperUnitTests { .containing("$set.concreteTypeWithListAttributeOfInterfaceType.models.[0]._class", ModelImpl.class.getName())); } - /** - * @see DATAMONGO-1236 - */ - @Test + @Test // DATAMONGO-1236 public void mappingShouldRetainTypeInformationForObjectValues() { Update update = new Update().set("value", new NestedDocument("kaladin")); @@ -819,10 +696,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().containing("$set.value._class", NestedDocument.class.getName())); } - /** - * @see DATAMONGO-1236 - */ - @Test + @Test // DATAMONGO-1236 public void mappingShouldNotRetainTypeInformationForConcreteValues() { Update update = new Update().set("concreteValue", new NestedDocument("shallan")); @@ -833,10 +707,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().notContaining("$set.concreteValue._class")); } - /** - * @see DATAMONGO-1236 - */ - @Test + @Test // DATAMONGO-1236 public void mappingShouldRetainTypeInformationForObjectValuesWithAlias() { Update update = new Update().set("value", new NestedDocument("adolin")); @@ -847,10 +718,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().containing("$set.renamed-value._class", NestedDocument.class.getName())); } - /** - * @see DATAMONGO-1236 - */ - @Test + @Test // DATAMONGO-1236 public void mappingShouldRetrainTypeInformationWhenValueTypeOfMapDoesNotMatchItsDeclaration() { Map map = Collections. singletonMap("szeth", new NestedDocument("son-son-vallano")); @@ -863,10 +731,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().containing("$set.map.szeth._class", NestedDocument.class.getName())); } - /** - * @see DATAMONGO-1236 - */ - @Test + @Test // DATAMONGO-1236 public void mappingShouldNotContainTypeInformationWhenValueTypeOfMapMatchesDeclaration() { Map map = Collections. singletonMap("jasnah", @@ -880,10 +745,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().notContaining("$set.concreteMap.jasnah._class")); } - /** - * @see DATAMONGO-1250 - */ - @Test + @Test // DATAMONGO-1250 @SuppressWarnings("unchecked") public void mapsUpdateWithBothReadingAndWritingConverterRegistered() { @@ -907,10 +769,7 @@ public class UpdateMapperUnitTests { assertThat(result, isBsonObject().containing("$set.allocation", Allocation.AVAILABLE.code)); } - /** - * @see DATAMONGO-1251 - */ - @Test + @Test // DATAMONGO-1251 public void mapsNullValueCorrectlyForSimpleTypes() { Update update = new Update().set("value", null); @@ -923,10 +782,7 @@ public class UpdateMapperUnitTests { assertThat($set.get("value"), nullValue()); } - /** - * @see DATAMONGO-1251 - */ - @Test + @Test // DATAMONGO-1251 public void mapsNullValueCorrectlyForJava8Date() { Update update = new Update().set("date", null); @@ -939,10 +795,7 @@ public class UpdateMapperUnitTests { assertThat($set.get("value"), nullValue()); } - /** - * @see DATAMONGO-1251 - */ - @Test + @Test // DATAMONGO-1251 public void mapsNullValueCorrectlyForCollectionTypes() { Update update = new Update().set("values", null); @@ -955,10 +808,7 @@ public class UpdateMapperUnitTests { assertThat($set.get("value"), nullValue()); } - /** - * @see DATAMONGO-1251 - */ - @Test + @Test // DATAMONGO-1251 public void mapsNullValueCorrectlyForPropertyOfNestedDocument() { Update update = new Update().set("concreteValue.name", null); @@ -971,10 +821,7 @@ public class UpdateMapperUnitTests { assertThat($set.get("concreteValue.name"), nullValue()); } - /** - * @see DATAMONGO-1288 - */ - @Test + @Test // DATAMONGO-1288 public void mapsAtomicIntegerToIntegerCorrectly() { Update update = new Update().set("intValue", new AtomicInteger(10)); @@ -985,10 +832,7 @@ public class UpdateMapperUnitTests { assertThat($set.get("intValue"), Is. is(10)); } - /** - * @see DATAMONGO-1288 - */ - @Test + @Test // DATAMONGO-1288 public void mapsAtomicIntegerToPrimitiveIntegerCorrectly() { Update update = new Update().set("primIntValue", new AtomicInteger(10)); @@ -999,10 +843,7 @@ public class UpdateMapperUnitTests { assertThat($set.get("primIntValue"), Is. is(10)); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void mapsMinCorrectly() { Update update = new Update().min("minfield", 10); @@ -1012,10 +853,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().containing("$min", new BasicDBObject("minfield", 10))); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void mapsMaxCorrectly() { Update update = new Update().max("maxfield", 999); @@ -1025,10 +863,7 @@ public class UpdateMapperUnitTests { assertThat(mappedUpdate, isBsonObject().containing("$max", new BasicDBObject("maxfield", 999))); } - /** - * @see DATAMONGO-1423 - */ - @Test + @Test // DATAMONGO-1423 @SuppressWarnings("unchecked") public void mappingShouldConsiderCustomConvertersForEnumMapKeys() { @@ -1052,10 +887,7 @@ public class UpdateMapperUnitTests { assertThat(result, isBsonObject().containing("$set.enumAsMapKey.V", 100)); } - /** - * @see DATAMONGO-1486 - */ - @Test + @Test // DATAMONGO-1486 public void mappingShouldConvertMapKeysToString() { Update update = new Update().set("map", Collections.singletonMap(25, "#StarTrek50")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/AbstractGeoSpatialTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/AbstractGeoSpatialTests.java index 9b756bf01..59ef1c485 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/AbstractGeoSpatialTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/AbstractGeoSpatialTests.java @@ -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. @@ -175,10 +175,7 @@ public abstract class AbstractGeoSpatialTests { assertThat(venues.size(), is(11)); } - /** - * @see DATAMONGO-1360 - */ - @Test + @Test // DATAMONGO-1360 public void mapsQueryContainedInNearQuery() { Query query = query(where("openingDate").lt(LocalDate.now())); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonModuleUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonModuleUnitTests.java index 97b282317..6950c5c60 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonModuleUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonModuleUnitTests.java @@ -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. @@ -43,10 +43,7 @@ public class GeoJsonModuleUnitTests { mapper.registerModule(new GeoJsonModule()); } - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 public void shouldDeserializeJsonPointCorrectly() throws JsonParseException, JsonMappingException, IOException { String json = "{ \"type\": \"Point\", \"coordinates\": [10.0, 20.0] }"; @@ -54,10 +51,7 @@ public class GeoJsonModuleUnitTests { assertThat(mapper.readValue(json, GeoJsonPoint.class), is(new GeoJsonPoint(10D, 20D))); } - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 public void shouldDeserializeGeoJsonLineStringCorrectly() throws JsonParseException, JsonMappingException, IOException { @@ -67,10 +61,7 @@ public class GeoJsonModuleUnitTests { is(new GeoJsonLineString(Arrays.asList(new Point(10, 20), new Point(30, 40), new Point(50, 60))))); } - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 public void shouldDeserializeGeoJsonMultiPointCorrectly() throws JsonParseException, JsonMappingException, IOException { @@ -80,10 +71,7 @@ public class GeoJsonModuleUnitTests { is(new GeoJsonMultiPoint(Arrays.asList(new Point(10, 20), new Point(30, 40), new Point(50, 60))))); } - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 @SuppressWarnings("unchecked") public void shouldDeserializeGeoJsonMultiLineStringCorrectly() throws JsonParseException, JsonMappingException, IOException { @@ -96,10 +84,7 @@ public class GeoJsonModuleUnitTests { 60), new Point(70, 80))))); } - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 public void shouldDeserializeGeoJsonPolygonCorrectly() throws JsonParseException, JsonMappingException, IOException { String json = "{ \"type\": \"Polygon\", \"coordinates\": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ]}"; @@ -110,10 +95,7 @@ public class GeoJsonModuleUnitTests { new Point(100, 0))))); } - /** - * @see DATAMONGO-1181 - */ - @Test + @Test // DATAMONGO-1181 public void shouldDeserializeGeoJsonMultiPolygonCorrectly() throws JsonParseException, JsonMappingException, IOException { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonTests.java index c94172774..9a8e79e95 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoJsonTests.java @@ -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. @@ -95,10 +95,7 @@ public class GeoJsonTests { removeCollections(); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void geoNear() { NearQuery geoNear = NearQuery.near(new GeoJsonPoint(-73, 40), Metrics.KILOMETERS).num(10).maxDistance(150); @@ -109,10 +106,7 @@ public class GeoJsonTests { assertThat(result.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void withinPolygon() { Point first = new Point(-73.99756, 40.73083); @@ -126,10 +120,7 @@ public class GeoJsonTests { assertThat(venues.size(), is(4)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void nearPoint() { GeoJsonPoint point = new GeoJsonPoint(-73.99171, 40.738868); @@ -139,10 +130,7 @@ public class GeoJsonTests { assertThat(venues.size(), is(1)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void nearSphere() { GeoJsonPoint point = new GeoJsonPoint(-73.99171, 40.738868); @@ -153,10 +141,7 @@ public class GeoJsonTests { assertThat(venues.size(), is(1)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonPointTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -171,10 +156,7 @@ public class GeoJsonTests { assertThat(result.geoJsonPoint, equalTo(obj.geoJsonPoint)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonPolygonTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -190,10 +172,7 @@ public class GeoJsonTests { assertThat(result.geoJsonPolygon, equalTo(obj.geoJsonPolygon)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonLineStringTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -208,10 +187,7 @@ public class GeoJsonTests { assertThat(result.geoJsonLineString, equalTo(obj.geoJsonLineString)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonMultiLineStringTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -227,10 +203,7 @@ public class GeoJsonTests { assertThat(result.geoJsonMultiLineString, equalTo(obj.geoJsonMultiLineString)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonMultiPointTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -245,10 +218,7 @@ public class GeoJsonTests { assertThat(result.geoJsonMultiPoint, equalTo(obj.geoJsonMultiPoint)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonMultiPolygonTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -264,10 +234,7 @@ public class GeoJsonTests { assertThat(result.geoJsonMultiPolygon, equalTo(obj.geoJsonMultiPolygon)); } - /** - * @see DATAMONGO-1137 - */ - @Test + @Test // DATAMONGO-1137 public void shouleSaveAndRetrieveDocumentWithGeoJsonGeometryCollectionTypeCorrectly() { DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType(); @@ -284,10 +251,7 @@ public class GeoJsonTests { assertThat(result.geoJsonGeometryCollection, equalTo(obj.geoJsonGeometryCollection)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void nearWithMinDistance() { Point point = new GeoJsonPoint(-73.99171, 40.738868); @@ -297,10 +261,7 @@ public class GeoJsonTests { assertThat(venues.size(), is(11)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void nearSphereWithMinDistance() { Point point = new GeoJsonPoint(-73.99171, 40.738868); @@ -310,10 +271,7 @@ public class GeoJsonTests { assertThat(venues.size(), is(11)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void nearWithMinAndMaxDistance() { GeoJsonPoint point = new GeoJsonPoint(-73.99171, 40.738868); @@ -323,10 +281,7 @@ public class GeoJsonTests { assertThat(venues.size(), is(2)); } - /** - * @see DATAMONGO-1453 - */ - @Test + @Test // DATAMONGO-1453 public void shouldConvertPointRepresentationCorrectlyWhenSourceCoordinatesUsesInteger() { this.template.execute(template.getCollectionName(DocumentWithPropertyUsingGeoJsonType.class), @@ -351,10 +306,7 @@ public class GeoJsonTests { DocumentWithPropertyUsingGeoJsonType.class).geoJsonPoint, is(equalTo(new GeoJsonPoint(0D, 0D)))); } - /** - * @see DATAMONGO-1453 - */ - @Test + @Test // DATAMONGO-1453 public void shouldConvertLineStringRepresentationCorrectlyWhenSourceCoordinatesUsesInteger() { this.template.execute(template.getCollectionName(DocumentWithPropertyUsingGeoJsonType.class), diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DSphereTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DSphereTests.java index a51bd46b9..a069b183c 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DSphereTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DSphereTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,10 +42,7 @@ import org.springframework.data.mongodb.core.query.NearQuery; */ public class GeoSpatial2DSphereTests extends AbstractGeoSpatialTests { - /** - * @see DATAMONGO-360 - */ - @Test + @Test // DATAMONGO-360 public void indexInfoIsCorrect() { IndexOperations operations = template.indexOps(Venue.class); @@ -62,10 +59,7 @@ public class GeoSpatial2DSphereTests extends AbstractGeoSpatialTests { assertThat(fields, hasItem(IndexField.geo("location"))); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void geoNearWithMinDistance() { NearQuery geoNear = NearQuery.near(-73, 40, Metrics.KILOMETERS).num(10).minDistance(1); @@ -76,10 +70,7 @@ public class GeoSpatial2DSphereTests extends AbstractGeoSpatialTests { assertThat(result.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void nearSphereWithMinDistance() { Point point = new Point(-73.99171, 40.738868); List venues = template.find(query(where("location").nearSphere(point).minDistance(0.01)), Venue.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DTests.java index e9248f63b..896871b34 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatial2DTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-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,10 +50,7 @@ public class GeoSpatial2DTests extends AbstractGeoSpatialTests { assertThat(venues.size(), is(7)); } - /** - * @see DATAMONGO-360 - */ - @Test + @Test // DATAMONGO-360 public void indexInfoIsCorrect() { IndexOperations operations = template.indexOps(Venue.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatialIndexTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatialIndexTests.java index 1c2f0a683..7341317d4 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatialIndexTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatialIndexTests.java @@ -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. @@ -60,10 +60,7 @@ public class GeoSpatialIndexTests extends AbstractIntegrationTests { template.setWriteResultChecking(WriteResultChecking.EXCEPTION); } - /** - * @see DATAMONGO-778 - */ - @Test + @Test // DATAMONGO-778 public void test2dIndex() { try { @@ -74,10 +71,7 @@ public class GeoSpatialIndexTests extends AbstractIntegrationTests { } } - /** - * @see DATAMONGO-778 - */ - @Test + @Test // DATAMONGO-778 public void test2dSphereIndex() { try { @@ -88,10 +82,7 @@ public class GeoSpatialIndexTests extends AbstractIntegrationTests { } } - /** - * @see DATAMONGO-778 - */ - @Test + @Test // DATAMONGO-778 public void testHaystackIndex() { try { @@ -102,10 +93,7 @@ public class GeoSpatialIndexTests extends AbstractIntegrationTests { } } - /** - * @see DATAMONGO-827 - */ - @Test + @Test // DATAMONGO-827 public void useGeneratedNameShouldGenerateAnIndexName() { try { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/IndexingIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/IndexingIntegrationTests.java index 2b748fc8d..abc4d6c6b 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/IndexingIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/IndexingIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 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. @@ -62,10 +62,7 @@ public class IndexingIntegrationTests { operations.dropCollection(IndexedPerson.class); } - /** - * @see DATAMONGO-237 - */ - @Test + @Test // DATAMONGO-237 @DirtiesContext public void createsIndexWithFieldName() { @@ -74,10 +71,7 @@ public class IndexingIntegrationTests { assertThat(hasIndex("_firstname", IndexedPerson.class), is(true)); } - /** - * @see DATAMONGO-1163 - */ - @Test + @Test // DATAMONGO-1163 @DirtiesContext public void createsIndexFromMetaAnnotation() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorIntegrationTests.java index 529828fe4..7ac592c1b 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorIntegrationTests.java @@ -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. @@ -83,10 +83,7 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests { assertThat(indexInfo, hasSize(0)); } - /** - * @see DATAMONGO-1202 - */ - @Test + @Test // DATAMONGO-1202 public void shouldHonorIndexedPropertiesWithRecursiveMappings() { List indexInfo = templateOne.indexOps(RecursiveConcreteType.class).getIndexInfo(); @@ -95,10 +92,7 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests { assertThat(indexInfo, Matchers. hasItem(hasProperty("name", is("firstName")))); } - /** - * @DATAMONGO-1125 - */ - @Test + @Test // DATAMONGO-1125 public void createIndexShouldThrowMeaningfulExceptionWhenIndexCreationFails() throws UnknownHostException { expectedException.expect(DataIntegrityViolationException.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorUnitTests.java index 093286aab..2013e49ae 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreatorUnitTests.java @@ -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. @@ -113,10 +113,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { verifyZeroInteractions(collection); } - /** - * @see DATAMONGO-530 - */ - @Test + @Test // DATAMONGO-530 public void isIndexCreatorForMappingContextHandedIntoConstructor() { MongoMappingContext mappingContext = new MongoMappingContext(); @@ -127,10 +124,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { assertThat(creator.isIndexCreatorFor(new MongoMappingContext()), is(false)); } - /** - * @see DATAMONGO-554 - */ - @Test + @Test // DATAMONGO-554 public void triggersBackgroundIndexingIfConfigured() { MongoMappingContext mappingContext = prepareMappingContext(AnotherPerson.class); @@ -143,10 +137,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { assertThat(optionsCaptor.getValue().get("expireAfterSeconds"), nullValue()); } - /** - * @see DATAMONGO-544 - */ - @Test + @Test // DATAMONGO-544 public void expireAfterSecondsIfConfigured() { MongoMappingContext mappingContext = prepareMappingContext(Milk.class); @@ -157,10 +148,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { assertThat(optionsCaptor.getValue().get("expireAfterSeconds"), IsEqual. equalTo(60L)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void createsNotNestedGeoSpatialIndexCorrectly() { MongoMappingContext mappingContext = prepareMappingContext(Wrapper.class); @@ -171,10 +159,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { .add("min", -180).add("max", 180).add("bits", 26).get())); } - /** - * @see DATAMONGO-827 - */ - @Test + @Test // DATAMONGO-827 public void autoGeneratedIndexNameShouldGenerateNoName() { MongoMappingContext mappingContext = prepareMappingContext(EntityWithGeneratedIndexName.class); @@ -185,10 +170,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { assertThat(optionsCaptor.getValue(), is(new BasicDBObjectBuilder().get())); } - /** - * @see DATAMONGO-367 - */ - @Test + @Test // DATAMONGO-367 public void indexCreationShouldNotCreateNewCollectionForNestedGeoSpatialIndexStructures() { MongoMappingContext mappingContext = prepareMappingContext(Wrapper.class); @@ -200,10 +182,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { assertThat(collectionNameCapturer.getValue(), equalTo("wrapper")); } - /** - * @see DATAMONGO-367 - */ - @Test + @Test // DATAMONGO-367 public void indexCreationShouldNotCreateNewCollectionForNestedIndexStructures() { MongoMappingContext mappingContext = prepareMappingContext(IndexedDocumentWrapper.class); @@ -215,10 +194,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { assertThat(collectionNameCapturer.getValue(), equalTo("indexedDocumentWrapper")); } - /** - * @see DATAMONGO-1125 - */ - @Test(expected = DataAccessException.class) + @Test(expected = DataAccessException.class) // DATAMONGO-1125 public void createIndexShouldUsePersistenceExceptionTranslatorForNonDataIntegrityConcerns() { when(factory.getExceptionTranslator()).thenReturn(new MongoExceptionTranslator()); @@ -230,10 +206,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests { new MongoPersistentEntityIndexCreator(mappingContext, factory); } - /** - * @see DATAMONGO-1125 - */ - @Test(expected = ClassCastException.class) + @Test(expected = ClassCastException.class) // DATAMONGO-1125 public void createIndexShouldNotConvertUnknownExceptionTypes() { when(factory.getExceptionTranslator()).thenReturn(new MongoExceptionTranslator()); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolverUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolverUnitTests.java index 97554b558..08bb3391d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolverUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolverUnitTests.java @@ -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. @@ -70,10 +70,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { */ public static class IndexResolutionTests { - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void indexPathOnLevelZeroIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -83,10 +80,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("indexedProperty", "Zero", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void indexPathOnLevelOneIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(IndexOnLevelOne.class); @@ -95,10 +89,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("zero.indexedProperty", "One", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void depplyNestedIndexPathIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(IndexOnLevelTwo.class); @@ -107,10 +98,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("one.zero.indexedProperty", "Two", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void resolvesIndexPathNameForNamedPropertiesCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -121,10 +109,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void resolvesIndexDefinitionCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -135,10 +120,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("name", "indexedProperty").get())); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void resolvesIndexDefinitionOptionsCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -150,10 +132,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { .add("sparse", true).add("background", true).add("expireAfterSeconds", 10L).get())); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void resolvesIndexCollectionNameCorrectlyWhenDefinedInAnnotation() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -161,10 +140,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions.get(0).getCollection(), equalTo("CollectionOverride")); } - /** - * @see DATAMONGO-1297 - */ - @Test + @Test // DATAMONGO-1297 public void resolvesIndexOnDbrefWhenDefined() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(WithDbRef.class); @@ -175,10 +151,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("indexedDbRef", 1).get())); } - /** - * @see DATAMONGO-1297 - */ - @Test + @Test // DATAMONGO-1297 public void resolvesIndexOnDbrefWhenDefinedOnNestedElement() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -190,10 +163,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("nested.indexedDbRef", 1).get())); } - /** - * @see DATAMONGO-1163 - */ - @Test + @Test // DATAMONGO-1163 public void resolveIndexDefinitionInMetaAnnotatedFields() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -205,10 +175,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("name", "_name").get())); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void resolveIndexDefinitionInComposedAnnotatedFields() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -223,10 +190,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { isBsonObject().containing("sparse", true).containing("unique", true).containing("name", "my_index_name")); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void resolveIndexDefinitionInCustomComposedAnnotatedFields() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -351,10 +315,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { */ public static class GeoSpatialIndexResolutionTests { - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void geoSpatialIndexPathOnLevelZeroIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -364,10 +325,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("geoIndexedProperty", "Zero", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void geoSpatialIndexPathOnLevelOneIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -377,10 +335,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("zero.geoIndexedProperty", "One", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void depplyNestedGeoSpatialIndexPathIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -390,10 +345,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("one.zero.geoIndexedProperty", "Two", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void resolvesIndexDefinitionOptionsCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -405,10 +357,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { new BasicDBObjectBuilder().add("name", "location").add("min", 1).add("max", 100).add("bits", 2).get())); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void resolvesComposedAnnotationIndexDefinitionOptionsCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -479,10 +428,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { */ public static class CompoundIndexResolutionTests { - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void compoundIndexPathOnLevelZeroIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -492,10 +438,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection(new String[] { "foo", "bar" }, "CompoundIndexOnLevelZero", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void compoundIndexOptionsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -508,10 +451,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("foo", 1).add("bar", -1).get())); } - /** - * @see DATAMONGO-909 - */ - @Test + @Test // DATAMONGO-909 public void compoundIndexOnSuperClassResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -524,10 +464,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("foo", 1).add("bar", -1).get())); } - /** - * @see DATAMONGO-827 - */ - @Test + @Test // DATAMONGO-827 public void compoundIndexDoesNotSpecifyNameWhenUsingGenerateName() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -540,10 +477,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("foo", 1).add("bar", -1).get())); } - /** - * @see DATAMONGO-929 - */ - @Test + @Test // DATAMONGO-929 public void compoundIndexPathOnLevelOneIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -554,10 +488,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { indexDefinitions.get(0)); } - /** - * @see DATAMONGO-929 - */ - @Test + @Test // DATAMONGO-929 public void emptyCompoundIndexPathOnLevelOneIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -568,10 +499,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { indexDefinitions.get(0)); } - /** - * @see DATAMONGO-929 - */ - @Test + @Test // DATAMONGO-929 public void singleCompoundIndexPathOnLevelZeroIsResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -581,10 +509,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection(new String[] { "foo", "bar" }, "CompoundIndexOnLevelZero", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void singleCompoundIndexUsingComposedAnnotationsOnTypeResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -665,10 +590,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { public static class TextIndexedResolutionTests { - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldResolveSingleFieldTextIndexCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -677,10 +599,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection("bar", "textIndexOnSinglePropertyInRoot", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldResolveMultiFieldTextIndexCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -690,10 +609,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { indexDefinitions.get(0)); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldResolveTextIndexOnElementCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -702,10 +618,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertIndexPathAndCollection(new String[] { "nested.foo" }, "textIndexOnNestedRoot", indexDefinitions.get(0)); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldResolveTextIndexOnElementWithWeightCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -718,10 +631,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(weights.get("nested.foo"), is((Object) 5F)); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldResolveTextIndexOnElementWithMostSpecificWeightCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -735,10 +645,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(weights.get("nested.bar"), is((Object) 10F)); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldSetDefaultLanguageCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -746,10 +653,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions.get(0).getIndexOptions().get("default_language"), is((Object) "spanish")); } - /** - * @see DATAMONGO-937, DATAMONGO-1049 - */ - @Test + @Test // DATAMONGO-937, DATAMONGO-1049 public void shouldResolveTextIndexLanguageOverrideCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -757,10 +661,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions.get(0).getIndexOptions().get("language_override"), is((Object) "lang")); } - /** - * @see DATAMONGO-1049 - */ - @Test + @Test // DATAMONGO-1049 public void shouldIgnoreTextIndexLanguageOverrideOnNestedElements() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -768,10 +669,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions.get(0).getIndexOptions().get("language_override"), is(nullValue())); } - /** - * @see DATAMONGO-1049 - */ - @Test + @Test // DATAMONGO-1049 public void shouldNotCreateIndexDefinitionWhenOnlyLanguageButNoTextIndexPresent() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -779,10 +677,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, is(empty())); } - /** - * @see DATAMONGO-1049 - */ - @Test + @Test // DATAMONGO-1049 public void shouldNotCreateIndexDefinitionWhenOnlyAnnotatedLanguageButNoTextIndexPresent() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -790,10 +685,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, is(empty())); } - /** - * @see DATAMONGO-1049 - */ - @Test + @Test // DATAMONGO-1049 public void shouldPreferExplicitlyAnnotatedLanguageProperty() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -801,10 +693,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions.get(0).getIndexOptions().get("language_override"), is((Object) "lang")); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void shouldResolveComposedAnnotationCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -918,10 +807,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { public static class MixedIndexResolutionTests { - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void multipleIndexesResolvedCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(MixedIndexRoot.class); @@ -931,10 +817,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions.get(1).getIndexDefinition(), instanceOf(GeospatialIndex.class)); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void cyclicPropertyReferenceOverDBRefShouldNotBeTraversed() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(Inner.class); @@ -943,20 +826,14 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo(new BasicDBObjectBuilder().add("outer", 1).get())); } - /** - * @see DATAMONGO-899 - */ - @Test + @Test // DATAMONGO-899 public void associationsShouldNotBeTraversed() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(Outer.class); assertThat(indexDefinitions, empty()); } - /** - * @see DATAMONGO-926 - */ - @Test + @Test // DATAMONGO-926 public void shouldNotRunIntoStackOverflow() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -964,10 +841,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, hasSize(1)); } - /** - * @see DATAMONGO-926 - */ - @Test + @Test // DATAMONGO-926 public void indexShouldBeFoundEvenForCyclePropertyReferenceOnLevelZero() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(CycleLevelZero.class); @@ -976,10 +850,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, hasSize(2)); } - /** - * @see DATAMONGO-926 - */ - @Test + @Test // DATAMONGO-926 public void indexShouldBeFoundEvenForCyclePropertyReferenceOnLevelOne() { List indexDefinitions = prepareMappingContextAndResolveIndexForType(CycleOnLevelOne.class); @@ -987,10 +858,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, hasSize(1)); } - /** - * @see DATAMONGO-926 - */ - @Test + @Test // DATAMONGO-926 public void indexBeResolvedCorrectlyWhenPropertiesOfDifferentTypesAreNamedEqually() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1002,10 +870,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, hasSize(3)); } - /** - * @see DATAMONGO-949 - */ - @Test + @Test // DATAMONGO-949 public void shouldNotDetectCycleInSimilarlyNamedProperties() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1014,10 +879,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, hasSize(1)); } - /** - * @see DATAMONGO-962 - */ - @Test + @Test // DATAMONGO-962 public void shouldDetectSelfCycleViaCollectionTypeCorrectly() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1025,10 +887,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, empty()); } - /** - * @see DATAMONGO-962 - */ - @Test + @Test // DATAMONGO-962 public void shouldNotDetectCycleWhenTypeIsUsedMoreThanOnce() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1036,10 +895,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat(indexDefinitions, empty()); } - /** - * @see DATAMONGO-962 - */ - @Test + @Test // DATAMONGO-962 @SuppressWarnings({ "rawtypes", "unchecked" }) public void shouldCatchCyclicReferenceExceptionOnRoot() { @@ -1058,10 +914,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { .resolveIndexForEntity(selfCyclingEntity); } - /** - * @see DATAMONGO-1025 - */ - @Test + @Test // DATAMONGO-1025 public void shouldUsePathIndexAsIndexNameForDocumentsHavingNamedNestedCompoundIndexFixedOnCollection() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1070,10 +923,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo("propertyOfTypeHavingNamedCompoundIndex.c_index")); } - /** - * @see DATAMONGO-1025 - */ - @Test + @Test // DATAMONGO-1025 public void shouldUseIndexNameForNestedTypesWithNamedCompoundIndexDefinition() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1082,10 +932,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo("propertyOfTypeHavingNamedCompoundIndex.c_index")); } - /** - * @see DATAMONGO-1025 - */ - @Test + @Test // DATAMONGO-1025 public void shouldUsePathIndexAsIndexNameForDocumentsHavingNamedNestedIndexFixedOnCollection() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1094,10 +941,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo("propertyOfTypeHavingNamedIndex.property_index")); } - /** - * @see DATAMONGO-1025 - */ - @Test + @Test // DATAMONGO-1025 public void shouldUseIndexNameForNestedTypesWithNamedIndexDefinition() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1106,10 +950,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { equalTo("propertyOfTypeHavingNamedIndex.property_index")); } - /** - * @see DATAMONGO-1025 - */ - @Test + @Test // DATAMONGO-1025 public void shouldUseIndexNameOnRootLevel() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1117,10 +958,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat((String) indexDefinitions.get(0).getIndexOptions().get("name"), equalTo("property_index")); } - /** - * @see DATAMONGO-1087 - */ - @Test + @Test // DATAMONGO-1087 public void shouldAllowMultiplePropertiesOfSameTypeWithMatchingStartLettersOnRoot() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1131,10 +969,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat((String) indexDefinitions.get(1).getIndexOptions().get("name"), equalTo("nameLast.component")); } - /** - * @see DATAMONGO-1087 - */ - @Test + @Test // DATAMONGO-1087 public void shouldAllowMultiplePropertiesOfSameTypeWithMatchingStartLettersOnNestedProperty() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1145,10 +980,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { assertThat((String) indexDefinitions.get(1).getIndexOptions().get("name"), equalTo("component.name")); } - /** - * @see DATAMONGO-1121 - */ - @Test + @Test // DATAMONGO-1121 public void shouldOnlyConsiderEntitiesAsPotentialCycleCandidates() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( @@ -1161,10 +993,7 @@ public class MongoPersistentEntityIndexResolverUnitTests { } - /** - * @see DATAMONGO-1263 - */ - @Test + @Test // DATAMONGO-1263 public void shouldConsiderGenericTypeArgumentsOfCollectionElements() { List indexDefinitions = prepareMappingContextAndResolveIndexForType( diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/PathUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/PathUnitTests.java index 9e88c00c1..52308193a 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/PathUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/PathUnitTests.java @@ -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. @@ -45,20 +45,14 @@ public class PathUnitTests { when(entityMock.getType()).thenReturn((Class) Object.class); } - /** - * @see DATAMONGO-962 - */ - @Test + @Test // DATAMONGO-962 public void shouldIdentifyCycleForOwnerOfSameTypeAndMatchingPath() { MongoPersistentProperty property = createPersistentPropertyMock(entityMock, "foo"); assertThat(new Path(property, "foo.bar").cycles(property, "foo.bar.bar"), is(true)); } - /** - * @see DATAMONGO-962 - */ - @Test + @Test // DATAMONGO-962 @SuppressWarnings("rawtypes") public void shouldAllowMatchingPathForDifferentOwners() { @@ -71,10 +65,7 @@ public class PathUnitTests { assertThat(new Path(existing, "foo.bar").cycles(toBeVerified, "foo.bar.bar"), is(false)); } - /** - * @see DATAMONGO-962 - */ - @Test + @Test // DATAMONGO-962 public void shouldAllowEqaulPropertiesOnDifferentPaths() { MongoPersistentProperty property = createPersistentPropertyMock(entityMock, "foo"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/TextIndexTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/TextIndexTests.java index 8047f0fe0..4123a2bdd 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/TextIndexTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/index/TextIndexTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,10 +52,7 @@ public class TextIndexTests extends AbstractIntegrationTests { this.indexOps = template.indexOps(TextIndexedDocumentRoot.class); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void indexInfoShouldHaveBeenCreatedCorrectly() { List indexInfos = indexOps.getIndexInfo(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasePerson.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasePerson.java index 8d2aec065..d30605d60 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasePerson.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasePerson.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 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. @@ -20,9 +20,9 @@ import com.querydsl.core.annotations.QuerySupertype; /** * {@link QuerySupertype} is necessary for Querydsl 2.2.0-beta4 to compile the query classes directly. Can be removed as - * soon as {@link https://bugs.launchpad.net/querydsl/+bug/776219} is fixed. + * soon as https://bugs.launchpad.net/querydsl/+bug/776219 is fixed. * - * @see https://bugs.launchpad.net/querydsl/+bug/776219 + * @see https://bugs.launchpad.net/querydsl/+bug/776219 * @author Jon Brisbin * @author Oliver Gierke */ diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntityUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntityUnitTests.java index e5f8c8725..cdbe8aed6 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntityUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentEntityUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 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. @@ -61,10 +61,7 @@ public class BasicMongoPersistentEntityUnitTests { assertThat(entity.getCollection(), is("35")); } - /** - * @see DATAMONGO-65, DATAMONGO-1108 - */ - @Test + @Test // DATAMONGO-65, DATAMONGO-1108 public void collectionAllowsReferencingSpringBean() { CollectionProvider provider = new CollectionProvider(); @@ -83,10 +80,7 @@ public class BasicMongoPersistentEntityUnitTests { assertThat(entity.getCollection(), is("otherReference")); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldDetectLanguageCorrectly() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -94,11 +88,8 @@ public class BasicMongoPersistentEntityUnitTests { assertThat(entity.getLanguage(), is("spanish")); } - /** - * @see DATAMONGO-1053 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-1053 public void verifyShouldThrowExceptionForInvalidTypeOfExplicitLanguageProperty() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -111,11 +102,8 @@ public class BasicMongoPersistentEntityUnitTests { entity.verify(); } - /** - * @see DATAMONGO-1053 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test + @Test // DATAMONGO-1053 public void verifyShouldPassForStringAsExplicitLanguageProperty() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -130,11 +118,8 @@ public class BasicMongoPersistentEntityUnitTests { verify(propertyMock, times(1)).getActualType(); } - /** - * @see DATAMONGO-1053 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test + @Test // DATAMONGO-1053 public void verifyShouldIgnoreNonExplicitLanguageProperty() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -149,11 +134,8 @@ public class BasicMongoPersistentEntityUnitTests { verify(propertyMock, never()).getActualType(); } - /** - * @see DATAMONGO-1157 - */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-1157 public void verifyShouldThrowErrorForLazyDBRefOnFinalClass() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -169,10 +151,7 @@ public class BasicMongoPersistentEntityUnitTests { entity.verify(); } - /** - * @see DATAMONGO-1157 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-1157 public void verifyShouldThrowErrorForLazyDBRefArray() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -188,10 +167,7 @@ public class BasicMongoPersistentEntityUnitTests { entity.verify(); } - /** - * @see DATAMONGO-1157 - */ - @Test + @Test // DATAMONGO-1157 @SuppressWarnings({ "unchecked", "rawtypes" }) public void verifyShouldPassForLazyDBRefOnNonArrayNonFinalClass() { @@ -210,10 +186,7 @@ public class BasicMongoPersistentEntityUnitTests { verify(propertyMock, times(1)).isDbReference(); } - /** - * @see DATAMONGO-1157 - */ - @Test + @Test // DATAMONGO-1157 @SuppressWarnings({ "unchecked", "rawtypes" }) public void verifyShouldPassForNonLazyDBRefOnFinalClass() { @@ -232,10 +205,7 @@ public class BasicMongoPersistentEntityUnitTests { verify(dbRefMock, times(1)).lazy(); } - /** - * @see DATAMONGO-1291 - */ - @Test + @Test // DATAMONGO-1291 public void metaInformationShouldBeReadCorrectlyFromInheritedDocumentAnnotation() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( @@ -244,10 +214,7 @@ public class BasicMongoPersistentEntityUnitTests { assertThat(entity.getCollection(), is("collection-1")); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void metaInformationShouldBeReadCorrectlyFromComposedDocumentAnnotation() { BasicMongoPersistentEntity entity = new BasicMongoPersistentEntity( diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentPropertyUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentPropertyUnitTests.java index 5f325e7aa..953077b88 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentPropertyUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/BasicMongoPersistentPropertyUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 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. @@ -84,20 +84,14 @@ public class BasicMongoPersistentPropertyUnitTests { getPropertyFor(ReflectionUtils.findField(Person.class, "ssn")); } - /** - * @see DATAMONGO-553 - */ - @Test + @Test // DATAMONGO-553 public void usesPropertyAccessForThrowableCause() { MongoPersistentProperty property = getPropertyFor(ReflectionUtils.findField(Throwable.class, "cause")); assertThat(property.usePropertyAccess(), is(true)); } - /** - * @see DATAMONGO-607 - */ - @Test + @Test // DATAMONGO-607 public void usesCustomFieldNamingStrategyByDefault() throws Exception { Field field = ReflectionUtils.findField(Person.class, "lastname"); @@ -113,10 +107,7 @@ public class BasicMongoPersistentPropertyUnitTests { assertThat(property.getFieldName(), is("foo")); } - /** - * @see DATAMONGO-607 - */ - @Test + @Test // DATAMONGO-607 public void rejectsInvalidValueReturnedByFieldNamingStrategy() { Field field = ReflectionUtils.findField(Person.class, "lastname"); @@ -130,60 +121,42 @@ public class BasicMongoPersistentPropertyUnitTests { property.getFieldName(); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldDetectAnnotatedLanguagePropertyCorrectly() { MongoPersistentProperty property = getPropertyFor(DocumentWithLanguageProperty.class, "lang"); assertThat(property.isLanguageProperty(), is(true)); } - /** - * @see DATAMONGO-937 - */ - @Test + @Test // DATAMONGO-937 public void shouldDetectIplicitLanguagePropertyCorrectly() { MongoPersistentProperty property = getPropertyFor(DocumentWithImplicitLanguageProperty.class, "language"); assertThat(property.isLanguageProperty(), is(true)); } - /** - * @see DATAMONGO-976 - */ - @Test + @Test // DATAMONGO-976 public void shouldDetectTextScorePropertyCorrectly() { MongoPersistentProperty property = getPropertyFor(DocumentWithTextScoreProperty.class, "score"); assertThat(property.isTextScoreProperty(), is(true)); } - /** - * @see DATAMONGO-976 - */ - @Test + @Test // DATAMONGO-976 public void shouldDetectTextScoreAsReadOnlyProperty() { MongoPersistentProperty property = getPropertyFor(DocumentWithTextScoreProperty.class, "score"); assertThat(property.isWritable(), is(false)); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void shouldNotConsiderExplicitlyNameFieldAsIdProperty() { MongoPersistentProperty property = getPropertyFor(DocumentWithExplicitlyRenamedIdProperty.class, "id"); assertThat(property.isIdProperty(), is(false)); } - /** - * @see DATAMONGO-1050 - */ - @Test + @Test // DATAMONGO-1050 public void shouldConsiderPropertyAsIdWhenExplicitlyAnnotatedWithIdEvenWhenExplicitlyNamePresent() { MongoPersistentProperty property = getPropertyFor(DocumentWithExplicitlyRenamedIdPropertyHavingIdAnnotation.class, @@ -191,10 +164,7 @@ public class BasicMongoPersistentPropertyUnitTests { assertThat(property.isIdProperty(), is(true)); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void shouldConsiderComposedAnnotationsForIdField() { MongoPersistentProperty property = getPropertyFor(DocumentWithComposedAnnotations.class, "myId"); @@ -202,10 +172,7 @@ public class BasicMongoPersistentPropertyUnitTests { assertThat(property.getFieldName(), is("_id")); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void shouldConsiderComposedAnnotationsForFields() { MongoPersistentProperty property = getPropertyFor(DocumentWithComposedAnnotations.class, "myField"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MappingTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MappingTests.java index b101ae6ba..b0969ea89 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MappingTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MappingTests.java @@ -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. @@ -441,10 +441,7 @@ public class MappingTests extends AbstractIntegrationTests { assertEquals(12L, p2.getPersonPojoLongId().getId()); } - /** - * @see DATADOC-275 - */ - @Test + @Test // DATADOC-275 public void readsAndWritesDBRefsCorrectly() { template.dropCollection(Item.class); @@ -467,10 +464,7 @@ public class MappingTests extends AbstractIntegrationTests { assertThat(result.items.get(0).id, is(items.id)); } - /** - * @see DATAMONGO-805 - */ - @Test + @Test // DATAMONGO-805 public void supportExcludeDbRefAssociation() { template.dropCollection(Item.class); @@ -492,10 +486,7 @@ public class MappingTests extends AbstractIntegrationTests { assertThat(result.item, is(nullValue())); } - /** - * @see DATAMONGO-805 - */ - @Test + @Test // DATAMONGO-805 public void shouldMapFieldsOfIterableEntity() { template.dropCollection(IterableItem.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MongoMappingContextUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MongoMappingContextUnitTests.java index 99e74c523..158e13957 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MongoMappingContextUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MongoMappingContextUnitTests.java @@ -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. @@ -67,20 +67,14 @@ public class MongoMappingContextUnitTests { assertThat(context.getPersistentEntity(DBRef.class), is(nullValue())); } - /** - * @see DATAMONGO-638 - */ - @Test + @Test // DATAMONGO-638 public void doesNotCreatePersistentEntityForAbstractMap() { MongoMappingContext context = new MongoMappingContext(); assertThat(context.getPersistentEntity(AbstractMap.class), is(nullValue())); } - /** - * @see DATAMONGO-607 - */ - @Test + @Test // DATAMONGO-607 public void populatesPersistentPropertyWithCustomFieldNamingStrategy() { MongoMappingContext context = new MongoMappingContext(); @@ -96,10 +90,7 @@ public class MongoMappingContextUnitTests { assertThat(entity.getPersistentProperty("firstname").getFieldName(), is("FIRSTNAME")); } - /** - * @see DATAMONGO-607 - */ - @Test + @Test // DATAMONGO-607 public void rejectsClassWithAmbiguousFieldMappings() { exception.expect(MappingException.class); @@ -113,10 +104,7 @@ public class MongoMappingContextUnitTests { context.getPersistentEntity(InvalidPerson.class); } - /** - * @see DATAMONGO-694 - */ - @Test + @Test // DATAMONGO-694 public void doesNotConsiderOverrridenAccessorANewField() { MongoMappingContext context = new MongoMappingContext(); @@ -124,10 +112,7 @@ public class MongoMappingContextUnitTests { context.getPersistentEntity(Child.class); } - /** - * @see DATAMONGO-688 - */ - @Test + @Test // DATAMONGO-688 public void mappingContextShouldAcceptClassWithImplicitIdProperty() { MongoMappingContext context = new MongoMappingContext(); @@ -137,10 +122,7 @@ public class MongoMappingContextUnitTests { assertThat(pe.isIdProperty(pe.getPersistentProperty("id")), is(true)); } - /** - * @see DATAMONGO-688 - */ - @Test + @Test // DATAMONGO-688 public void mappingContextShouldAcceptClassWithExplicitIdProperty() { MongoMappingContext context = new MongoMappingContext(); @@ -150,10 +132,7 @@ public class MongoMappingContextUnitTests { assertThat(pe.isIdProperty(pe.getPersistentProperty("myId")), is(true)); } - /** - * @see DATAMONGO-688 - */ - @Test + @Test // DATAMONGO-688 public void mappingContextShouldAcceptClassWithExplicitAndImplicitIdPropertyByGivingPrecedenceToExplicitIdProperty() { MongoMappingContext context = new MongoMappingContext(); @@ -161,30 +140,21 @@ public class MongoMappingContextUnitTests { assertThat(pe, is(not(nullValue()))); } - /** - * @see DATAMONGO-688 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-688 public void rejectsClassWithAmbiguousExplicitIdPropertyFieldMappings() { MongoMappingContext context = new MongoMappingContext(); context.getPersistentEntity(ClassWithMultipleExplicitIds.class); } - /** - * @see DATAMONGO-688 - */ - @Test(expected = MappingException.class) + @Test(expected = MappingException.class) // DATAMONGO-688 public void rejectsClassWithAmbiguousImplicitIdPropertyFieldMappings() { MongoMappingContext context = new MongoMappingContext(); context.getPersistentEntity(ClassWithMultipleImplicitIds.class); } - /** - * @see DATAMONGO-976 - */ - @Test + @Test // DATAMONGO-976 public void shouldRejectClassWithInvalidTextScoreProperty() { exception.expect(MappingException.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AbstractMongoEventListenerUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AbstractMongoEventListenerUnitTests.java index 27847da9c..e5a004545 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AbstractMongoEventListenerUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AbstractMongoEventListenerUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 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. @@ -64,10 +64,7 @@ public class AbstractMongoEventListenerUnitTests { context.close(); } - /** - * @see DATAMONGO-289 - */ - @Test + @Test // DATAMONGO-289 public void afterLoadEffectGetsHandledCorrectly() { SamplePersonEventListener listener = new SamplePersonEventListener(); @@ -75,10 +72,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(listener.invokedOnAfterLoad, is(true)); } - /** - * @see DATAMONGO-289 - */ - @Test + @Test // DATAMONGO-289 public void afterLoadEventGetsFilteredForDomainType() { SamplePersonEventListener personListener = new SamplePersonEventListener(); @@ -90,10 +84,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(accountListener.invokedOnAfterLoad, is(false)); } - /** - * @see DATAMONGO-289 - */ - @Test + @Test // DATAMONGO-289 public void afterLoadEventGetsFilteredForDomainTypeWorksForSubtypes() { SamplePersonEventListener personListener = new SamplePersonEventListener(); @@ -105,10 +96,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(contactListener.invokedOnAfterLoad, is(true)); } - /** - * @see DATAMONGO-289 - */ - @Test + @Test // DATAMONGO-289 public void afterLoadEventGetsFilteredForDomainTypeWorksForSubtypes2() { SamplePersonEventListener personListener = new SamplePersonEventListener(); @@ -120,10 +108,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(contactListener.invokedOnAfterLoad, is(true)); } - /** - * @see DATAMONGO-333 - */ - @Test + @Test // DATAMONGO-333 @SuppressWarnings({ "rawtypes", "unchecked" }) public void handlesUntypedImplementations() { @@ -131,10 +116,7 @@ public class AbstractMongoEventListenerUnitTests { listener.onApplicationEvent(new MongoMappingEvent(new Object(), new BasicDBObject(), "collection")); } - /** - * @see DATAMONGO-545 - */ - @Test + @Test // DATAMONGO-545 public void invokeContactCallbackForPersonEvent() { MongoMappingEvent event = new BeforeDeleteEvent(new BasicDBObject(), Person.class, @@ -145,10 +127,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(listener.invokedOnBeforeDelete, is(true)); } - /** - * @see DATAMONGO-545 - */ - @Test + @Test // DATAMONGO-545 public void invokePersonCallbackForPersonEvent() { MongoMappingEvent event = new BeforeDeleteEvent(new BasicDBObject(), Person.class, @@ -159,10 +138,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(listener.invokedOnBeforeDelete, is(true)); } - /** - * @see DATAMONGO-545 - */ - @Test + @Test // DATAMONGO-545 public void dontInvokePersonCallbackForAccountEvent() { MongoMappingEvent event = new BeforeDeleteEvent(new BasicDBObject(), Account.class, @@ -173,10 +149,7 @@ public class AbstractMongoEventListenerUnitTests { assertThat(listener.invokedOnBeforeDelete, is(false)); } - /** - * @see DATAMONGO-545 - */ - @Test + @Test // DATAMONGO-545 public void donInvokePersonCallbackForUntypedEvent() { MongoMappingEvent event = new BeforeDeleteEvent(new BasicDBObject(), null, "collection-1"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ApplicationContextEventTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ApplicationContextEventTests.java index c600911ee..a99761349 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ApplicationContextEventTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ApplicationContextEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 by the original author(s). + * Copyright (c) 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. @@ -135,10 +135,7 @@ public class ApplicationContextEventTests { comparePersonAndDbo(p, p2, dbo); } - /** - * @see DATAMONGO-1256 - */ - @Test + @Test // DATAMONGO-1256 public void loadAndConvertEvents() { PersonPojoStringId entity = new PersonPojoStringId("1", "Text"); @@ -156,10 +153,7 @@ public class ApplicationContextEventTests { assertThat(simpleMappingEventListener.onAfterConvertEvents.get(0).getCollectionName(), is(COLLECTION_NAME)); } - /** - * @see DATAMONGO-1256 - */ - @Test + @Test // DATAMONGO-1256 public void loadEventsOnAggregation() { template.insert(new PersonPojoStringId("1", "Text")); @@ -177,10 +171,7 @@ public class ApplicationContextEventTests { assertThat(simpleMappingEventListener.onAfterConvertEvents.get(0).getCollectionName(), is(COLLECTION_NAME)); } - /** - * @see DATAMONGO-1256 - */ - @Test + @Test // DATAMONGO-1256 public void deleteEvents() { PersonPojoStringId entity = new PersonPojoStringId("1", "Text"); @@ -195,10 +186,7 @@ public class ApplicationContextEventTests { assertThat(simpleMappingEventListener.onAfterDeleteEvents.get(0).getCollectionName(), is(COLLECTION_NAME)); } - /** - * @see DATAMONGO-1271 - */ - @Test + @Test // DATAMONGO-1271 public void publishesAfterLoadAndAfterConvertEventsForDBRef() throws Exception { Related ref1 = new Related(2L, "related desc1"); @@ -226,10 +214,7 @@ public class ApplicationContextEventTests { is(equalTo(ROOT_COLLECTION_NAME))); } - /** - * @see DATAMONGO-1271 - */ - @Test + @Test // DATAMONGO-1271 public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingDBRef() throws Exception { Related ref1 = new Related(2L, "related desc1"); @@ -263,10 +248,7 @@ public class ApplicationContextEventTests { is(equalTo(RELATED_COLLECTION_NAME))); } - /** - * @see DATAMONGO-1271 - */ - @Test + @Test // DATAMONGO-1271 public void publishesAfterLoadAndAfterConvertEventsForListOfDBRef() throws Exception { List references = Arrays.asList(new Related(20L, "ref 1"), new Related(30L, "ref 2")); @@ -298,10 +280,7 @@ public class ApplicationContextEventTests { is(equalTo(ROOT_COLLECTION_NAME))); } - /** - * @see DATAMONGO-1271 - */ - @Test + @Test // DATAMONGO-1271 public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingListOfDBRef() throws Exception { List references = Arrays.asList(new Related(20L, "ref 1"), new Related(30L, "ref 2")); @@ -338,10 +317,7 @@ public class ApplicationContextEventTests { is(equalTo(RELATED_COLLECTION_NAME))); } - /** - * @see DATAMONGO-1271 - */ - @Test + @Test // DATAMONGO-1271 public void publishesAfterLoadAndAfterConvertEventsForMapOfDBRef() throws Exception { Map references = new LinkedHashMap(); @@ -375,10 +351,7 @@ public class ApplicationContextEventTests { is(equalTo(ROOT_COLLECTION_NAME))); } - /** - * @see DATAMONGO-1271 - */ - @Test + @Test // DATAMONGO-1271 public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingMapOfDBRef() throws Exception { Map references = new LinkedHashMap(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java index 6cc1c0043..ff703cf6d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java @@ -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. @@ -65,18 +65,12 @@ public class AuditingEventListenerUnitTests { }); } - /** - * @see DATAMONGO-577 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-577 public void rejectsNullAuditingHandler() { new AuditingEventListener(null); } - /** - * @see DATAMONGO-577 - */ - @Test + @Test // DATAMONGO-577 public void triggersCreationMarkForObjectWithEmptyId() { Sample sample = new Sample(); @@ -86,10 +80,7 @@ public class AuditingEventListenerUnitTests { verify(handler, times(0)).markModified(Mockito.any(Sample.class)); } - /** - * @see DATAMONGO-577 - */ - @Test + @Test // DATAMONGO-577 public void triggersModificationMarkForObjectWithSetId() { Sample sample = new Sample(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/PersonBeforeSaveListener.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/PersonBeforeSaveListener.java index eda34e756..c5b5e36d9 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/PersonBeforeSaveListener.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/PersonBeforeSaveListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 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. diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/User.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/User.java index c638aeadc..e5c2a7808 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/User.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/User.java @@ -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. @@ -22,7 +22,6 @@ import javax.validation.constraints.Size; * Class used to test JSR-303 validation * {@link org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener} * - * @see DATAMONGO-36 * @author Maciej Walkowiak */ public class User { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ValidatingMongoEventListenerTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ValidatingMongoEventListenerTests.java index 8a8d06cd3..47137b805 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ValidatingMongoEventListenerTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ValidatingMongoEventListenerTests.java @@ -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. @@ -33,7 +33,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * Integration test for {@link ValidatingMongoEventListener}. * - * @see DATAMONGO-36 * @author Maciej Walkowiak * @author Oliver Gierke * @author Christoph Strobl @@ -46,7 +45,7 @@ public class ValidatingMongoEventListenerTests { @Autowired MongoTemplate mongoTemplate; - @Test + @Test // DATAMONGO-36 public void shouldThrowConstraintViolationException() { User user = new User("john", 17); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceCountsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceCountsUnitTests.java index a0da06bc0..9aeda12dc 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceCountsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceCountsUnitTests.java @@ -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. @@ -27,10 +27,7 @@ import org.junit.Test; */ public class MapReduceCountsUnitTests { - /** - * @see DATACMNS-378 - */ - @Test + @Test // DATACMNS-378 public void equalsForSameNumberValues() { MapReduceCounts left = new MapReduceCounts(1L, 1L, 1L); @@ -41,10 +38,7 @@ public class MapReduceCountsUnitTests { assertThat(left.hashCode(), is(right.hashCode())); } - /** - * @see DATACMNS-378 - */ - @Test + @Test // DATACMNS-378 public void notEqualForDifferentNumberValues() { MapReduceCounts left = new MapReduceCounts(1L, 1L, 1L); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceOptionsTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceOptionsTests.java index 9cc1728de..699802ea0 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceOptionsTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceOptionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-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. @@ -32,10 +32,7 @@ public class MapReduceOptionsTests { new MapReduceOptions().finalizeFunction("code"); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void limitShouldBeIncludedCorrectly() { MapReduceOptions options = new MapReduceOptions(); @@ -44,10 +41,7 @@ public class MapReduceOptionsTests { assertThat(options.getOptionsObject(), isBsonObject().containing("limit", 10)); } - /** - * @see DATAMONGO-1334 - */ - @Test + @Test // DATAMONGO-1334 public void limitShouldNotBePresentInDboWhenNotSet() { assertThat(new MapReduceOptions().getOptionsObject(), isBsonObject().notContaining("limit")); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceResultsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceResultsUnitTests.java index 087ee786e..a960c67c5 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceResultsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceResultsUnitTests.java @@ -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. @@ -32,10 +32,7 @@ import com.mongodb.DBObject; */ public class MapReduceResultsUnitTests { - /** - * @see DATAMONGO-428 - */ - @Test + @Test // DATAMONGO-428 public void resolvesOutputCollectionForPlainResult() { DBObject rawResult = new BasicDBObject("result", "FOO"); @@ -44,10 +41,7 @@ public class MapReduceResultsUnitTests { assertThat(results.getOutputCollection(), is("FOO")); } - /** - * @see DATAMONGO-428 - */ - @Test + @Test // DATAMONGO-428 public void resolvesOutputCollectionForDBObjectResult() { DBObject rawResult = new BasicDBObject("result", new BasicDBObject("collection", "FOO")); @@ -56,10 +50,7 @@ public class MapReduceResultsUnitTests { assertThat(results.getOutputCollection(), is("FOO")); } - /** - * @see DATAMONGO-378 - */ - @Test + @Test // DATAMONGO-378 public void handlesLongTotalInResult() { DBObject inner = new BasicDBObject("total", 1L); @@ -70,10 +61,7 @@ public class MapReduceResultsUnitTests { new MapReduceResults(Collections.emptyList(), source); } - /** - * @see DATAMONGO-378 - */ - @Test + @Test // DATAMONGO-378 public void handlesLongResultsForCounts() { DBObject inner = new BasicDBObject("input", 1L); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceTests.java index d97116833..76319ef43 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapreduce/MapReduceTests.java @@ -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. @@ -278,10 +278,7 @@ public class MapReduceTests { } - /** - * @see DATAMONGO-938 - */ - @Test + @Test // DATAMONGO-938 public void mapReduceShouldUseQueryMapper() { DBCollection c = mongoTemplate.getDb().getCollection("jmrWithGeo"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/BasicQueryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/BasicQueryUnitTests.java index e933768b1..da4d8ab17 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/BasicQueryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/BasicQueryUnitTests.java @@ -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. @@ -65,10 +65,7 @@ public class BasicQueryUnitTests { assertThat(query.getSortObject(), is(sortReference)); } - /** - * @see DATAMONGO-1093 - */ - @Test + @Test // DATAMONGO-1093 public void equalsContract() { BasicQuery query1 = new BasicQuery("{ \"name\" : \"Thomas\"}", "{\"name\":1, \"age\":1}"); @@ -83,10 +80,7 @@ public class BasicQueryUnitTests { .verify(); } - /** - * @see DATAMONGO-1093 - */ - @Test + @Test // DATAMONGO-1093 public void handlesEqualsAndHashCodeCorrectlyForExactCopies() { String qry = "{ \"name\" : \"Thomas\"}"; @@ -103,10 +97,7 @@ public class BasicQueryUnitTests { assertThat(query1.hashCode(), is(query2.hashCode())); } - /** - * @see DATAMONGO-1093 - */ - @Test + @Test // DATAMONGO-1093 public void handlesEqualsAndHashCodeCorrectlyWhenBasicQuerySettingsDiffer() { String qry = "{ \"name\" : \"Thomas\"}"; @@ -122,10 +113,7 @@ public class BasicQueryUnitTests { assertThat(query1.hashCode(), is(not(query2.hashCode()))); } - /** - * @see DATAMONGO-1093 - */ - @Test + @Test // DATAMONGO-1093 public void handlesEqualsAndHashCodeCorrectlyWhenQuerySettingsDiffer() { String qry = "{ \"name\" : \"Thomas\"}"; @@ -141,10 +129,7 @@ public class BasicQueryUnitTests { assertThat(query1.hashCode(), is(not(query2.hashCode()))); } - /** - * @see DATAMONGO-1387 - */ - @Test + @Test // DATAMONGO-1387 public void returnsFieldsCorrectly() { String qry = "{ \"name\" : \"Thomas\"}"; @@ -155,10 +140,7 @@ public class BasicQueryUnitTests { assertThat(query1.getFieldsObject(), isBsonObject().containing("name").containing("age")); } - /** - * @see DATAMONGO-1387 - */ - @Test + @Test // DATAMONGO-1387 public void handlesFieldsIncludeCorrectly() { String qry = "{ \"name\" : \"Thomas\"}"; @@ -169,10 +151,7 @@ public class BasicQueryUnitTests { assertThat(query1.getFieldsObject(), isBsonObject().containing("name")); } - /** - * @see DATAMONGO-1387 - */ - @Test + @Test // DATAMONGO-1387 public void combinesFieldsIncludeCorrectly() { String qry = "{ \"name\" : \"Thomas\"}"; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/CriteriaTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/CriteriaTests.java index dc8e1ce84..f73fbfde1 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/CriteriaTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/CriteriaTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 the original author or authors. + * Copyright 2010-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 CriteriaTests { assertThat(right, is(not(left))); } - /** - * @see DATAMONGO-507 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-507 public void shouldThrowExceptionWhenTryingToNegateAndOperation() { new Criteria() // @@ -90,10 +87,7 @@ public class CriteriaTests { .andOperator(Criteria.where("delete").is(true).and("_id").is(42)); // } - /** - * @see DATAMONGO-507 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-507 public void shouldThrowExceptionWhenTryingToNegateOrOperation() { new Criteria() // @@ -101,10 +95,7 @@ public class CriteriaTests { .orOperator(Criteria.where("delete").is(true).and("_id").is(42)); // } - /** - * @see DATAMONGO-507 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-507 public void shouldThrowExceptionWhenTryingToNegateNorOperation() { new Criteria() // @@ -112,10 +103,7 @@ public class CriteriaTests { .norOperator(Criteria.where("delete").is(true).and("_id").is(42)); // } - /** - * @see DATAMONGO-507 - */ - @Test + @Test // DATAMONGO-507 public void shouldNegateFollowingSimpleExpression() { Criteria c = Criteria.where("age").not().gt(18).and("status").is("student"); @@ -125,10 +113,7 @@ public class CriteriaTests { assertThat(co.toString(), is("{ \"age\" : { \"$not\" : { \"$gt\" : 18}} , \"status\" : \"student\"}")); } - /** - * @see DATAMONGO-1068 - */ - @Test + @Test // DATAMONGO-1068 public void getCriteriaObjectShouldReturnEmptyDBOWhenNoCriteriaSpecified() { DBObject dbo = new Criteria().getCriteriaObject(); @@ -136,10 +121,7 @@ public class CriteriaTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().get())); } - /** - * @see DATAMONGO-1068 - */ - @Test + @Test // DATAMONGO-1068 public void getCriteriaObjectShouldUseCritieraValuesWhenNoKeyIsPresent() { DBObject dbo = new Criteria().lt("foo").getCriteriaObject(); @@ -147,10 +129,7 @@ public class CriteriaTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("$lt", "foo").get())); } - /** - * @see DATAMONGO-1068 - */ - @Test + @Test // DATAMONGO-1068 public void getCriteriaObjectShouldUseCritieraValuesWhenNoKeyIsPresentButMultipleCriteriasPresent() { DBObject dbo = new Criteria().lt("foo").gt("bar").getCriteriaObject(); @@ -158,10 +137,7 @@ public class CriteriaTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("$lt", "foo").add("$gt", "bar").get())); } - /** - * @see DATAMONGO-1068 - */ - @Test + @Test // DATAMONGO-1068 public void getCriteriaObjectShouldRespectNotWhenNoKeyPresent() { DBObject dbo = new Criteria().lt("foo").not().getCriteriaObject(); @@ -169,10 +145,7 @@ public class CriteriaTests { assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("$not", new BasicDBObject("$lt", "foo")).get())); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void geoJsonTypesShouldBeWrappedInGeometry() { DBObject dbo = new Criteria("foo").near(new GeoJsonPoint(100, 200)).getCriteriaObject(); @@ -180,10 +153,7 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().containing("foo.$near.$geometry", new GeoJsonPoint(100, 200))); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void legacyCoordinateTypesShouldNotBeWrappedInGeometry() { DBObject dbo = new Criteria("foo").near(new Point(100, 200)).getCriteriaObject(); @@ -191,10 +161,7 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().notContaining("foo.$near.$geometry")); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void maxDistanceShouldBeMappedInsideNearWhenUsedAlongWithGeoJsonType() { DBObject dbo = new Criteria("foo").near(new GeoJsonPoint(100, 200)).maxDistance(50D).getCriteriaObject(); @@ -202,10 +169,7 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().containing("foo.$near.$maxDistance", 50D)); } - /** - * @see DATAMONGO-1135 - */ - @Test + @Test // DATAMONGO-1135 public void maxDistanceShouldBeMappedInsideNearSphereWhenUsedAlongWithGeoJsonType() { DBObject dbo = new Criteria("foo").nearSphere(new GeoJsonPoint(100, 200)).maxDistance(50D).getCriteriaObject(); @@ -213,10 +177,7 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().containing("foo.$nearSphere.$maxDistance", 50D)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void minDistanceShouldBeMappedInsideNearWhenUsedAlongWithGeoJsonType() { DBObject dbo = new Criteria("foo").near(new GeoJsonPoint(100, 200)).minDistance(50D).getCriteriaObject(); @@ -224,10 +185,7 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().containing("foo.$near.$minDistance", 50D)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void minDistanceShouldBeMappedInsideNearSphereWhenUsedAlongWithGeoJsonType() { DBObject dbo = new Criteria("foo").nearSphere(new GeoJsonPoint(100, 200)).minDistance(50D).getCriteriaObject(); @@ -235,10 +193,7 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().containing("foo.$nearSphere.$minDistance", 50D)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void minAndMaxDistanceShouldBeMappedInsideNearSphereWhenUsedAlongWithGeoJsonType() { DBObject dbo = new Criteria("foo").nearSphere(new GeoJsonPoint(100, 200)).minDistance(50D).maxDistance(100D) @@ -248,18 +203,12 @@ public class CriteriaTests { assertThat(dbo, isBsonObject().containing("foo.$nearSphere.$maxDistance", 100D)); } - /** - * @see DATAMONGO-1134 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1134 public void intersectsShouldThrowExceptionWhenCalledWihtNullValue() { new Criteria("foo").intersects(null); } - /** - * @see DATAMONGO-1134 - */ - @Test + @Test // DATAMONGO-1134 public void intersectsShouldWrapGeoJsonTypeInGeometryCorrectly() { GeoJsonLineString lineString = new GeoJsonLineString(new Point(0, 0), new Point(10, 10)); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/IndexUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/IndexUnitTests.java index 97384eb54..b4c7013f7 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/IndexUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/IndexUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 the original author or authors. + * Copyright 2010-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. @@ -76,10 +76,7 @@ public class IndexUnitTests { assertEquals("{ \"min\" : 0}", i.getIndexOptions().toString()); } - /** - * @see DATAMONGO-778 - */ - @Test + @Test // DATAMONGO-778 public void testGeospatialIndex2DSphere() { GeospatialIndex i = new GeospatialIndex("location").typed(GeoSpatialIndexType.GEO_2DSPHERE); @@ -87,10 +84,7 @@ public class IndexUnitTests { assertEquals("{ }", i.getIndexOptions().toString()); } - /** - * @see DATAMONGO-778 - */ - @Test + @Test // DATAMONGO-778 public void testGeospatialIndexGeoHaystack() { GeospatialIndex i = new GeospatialIndex("location").typed(GeoSpatialIndexType.GEO_HAYSTACK) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/NearQueryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/NearQueryUnitTests.java index 10232f56f..b89876ffc 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/NearQueryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/NearQueryUnitTests.java @@ -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. @@ -83,10 +83,7 @@ public class NearQueryUnitTests { assertThat(query.getMetric(), is((Metric) Metrics.MILES)); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void shouldTakeSkipAndLimitSettingsFromGivenPageable() { Pageable pageable = new PageRequest(3, 5); @@ -96,10 +93,7 @@ public class NearQueryUnitTests { assertThat((Integer) query.toDBObject().get("num"), is((pageable.getPageNumber() + 1) * pageable.getPageSize())); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void shouldTakeSkipAndLimitSettingsFromGivenQuery() { int limit = 10; @@ -111,10 +105,7 @@ public class NearQueryUnitTests { assertThat((Integer) query.toDBObject().get("num"), is(limit)); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void shouldTakeSkipAndLimitSettingsFromPageableEvenIfItWasSpecifiedOnQuery() { int limit = 10; @@ -127,28 +118,19 @@ public class NearQueryUnitTests { assertThat((Integer) query.toDBObject().get("num"), is((pageable.getPageNumber() + 1) * pageable.getPageSize())); } - /** - * @see DATAMONGO-829 - */ - @Test + @Test // DATAMONGO-829 public void nearQueryShouldInoreZeroLimitFromQuery() { NearQuery query = NearQuery.near(new Point(1, 2)).query(Query.query(Criteria.where("foo").is("bar"))); assertThat(query.toDBObject().get("num"), nullValue()); } - /** - * @see DATAMONOGO-829 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONOGO-829 public void nearQueryShouldThrowExceptionWhenGivenANullQuery() { NearQuery.near(new Point(1, 2)).query(null); } - /** - * @see DATAMONGO-829 - */ - @Test + @Test // DATAMONGO-829 public void numShouldNotBeAlteredByQueryWithoutPageable() { int num = 100; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java index d1b4b28c9..a152374e1 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 the original author or authors. + * Copyright 2010-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. @@ -108,10 +108,7 @@ public class QueryTests { Assert.assertEquals(expectedFields, q.getFieldsObject().toString()); } - /** - * @see DATAMONGO-652 - */ - @Test + @Test // DATAMONGO-652 public void testQueryWithFieldsElemMatchAndPositionalOperator() { Query query = query(where("name").gte("M").lte("T").and("age").not().gt(22)); @@ -179,10 +176,7 @@ public class QueryTests { Assert.assertEquals(expected, q.getQueryObject().toString()); } - /** - * @see DATAMONGO-538 - */ - @Test + @Test // DATAMONGO-538 public void addsSortCorrectly() { Query query = new Query().with(new Sort(Direction.DESC, "foo")); @@ -198,10 +192,7 @@ public class QueryTests { new Query().with(new Sort(new Sort.Order("foo").ignoreCase())); } - /** - * @see DATAMONGO-709 - */ - @Test + @Test // DATAMONGO-709 @SuppressWarnings("unchecked") public void shouldReturnClassHierarchyOfRestrictedTypes() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/SortTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/SortTests.java index 6450ac7d6..701193bd2 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/SortTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/SortTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 the original author or authors. + * Copyright 2010-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. @@ -41,10 +41,7 @@ public class SortTests { assertEquals("{ \"name\" : -1}", s.getSortObject().toString()); } - /** - * @see DATADOC-177 - */ - @Test + @Test // DATADOC-177 public void preservesOrderKeysOnMultipleSorts() { Query sort = new Query().with(new Sort(Direction.DESC, "foo").and(new Sort(Direction.DESC, "bar"))); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextCriteriaUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextCriteriaUnitTests.java index 64d96ff48..8b650f5d9 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextCriteriaUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextCriteriaUnitTests.java @@ -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. @@ -33,50 +33,35 @@ import com.mongodb.util.JSON; */ public class TextCriteriaUnitTests { - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldNotHaveLanguageField() { TextCriteria criteria = TextCriteria.forDefaultLanguage(); assertThat(criteria.getCriteriaObject(), equalTo(searchObject("{ }"))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldNotHaveLanguageForNonDefaultLanguageField() { TextCriteria criteria = TextCriteria.forLanguage("spanish"); assertThat(criteria.getCriteriaObject(), equalTo(searchObject("{ \"$language\" : \"spanish\" }"))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateSearchFieldForSingleTermCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().matching("cake"); assertThat(criteria.getCriteriaObject(), equalTo(searchObject("{ \"$search\" : \"cake\" }"))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateSearchFieldCorrectlyForMultipleTermsCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().matchingAny("bake", "coffee", "cake"); assertThat(criteria.getCriteriaObject(), equalTo(searchObject("{ \"$search\" : \"bake coffee cake\" }"))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateSearchFieldForPhraseCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().matchingPhrase("coffee cake"); @@ -84,30 +69,21 @@ public class TextCriteriaUnitTests { equalTo((DBObject) new BasicDBObject("$search", "\"coffee cake\""))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateNotFieldCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().notMatching("cake"); assertThat(criteria.getCriteriaObject(), equalTo(searchObject("{ \"$search\" : \"-cake\" }"))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateSearchFieldCorrectlyForNotMultipleTermsCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().notMatchingAny("bake", "coffee", "cake"); assertThat(criteria.getCriteriaObject(), equalTo(searchObject("{ \"$search\" : \"-bake -coffee -cake\" }"))); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateSearchFieldForNotPhraseCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().notMatchingPhrase("coffee cake"); @@ -115,10 +91,7 @@ public class TextCriteriaUnitTests { equalTo((DBObject) new BasicDBObject("$search", "-\"coffee cake\""))); } - /** - * @see DATAMONGO-1455 - */ - @Test + @Test // DATAMONGO-1455 public void caseSensitiveOperatorShouldBeSetCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().matching("coffee").caseSensitive(true); @@ -126,10 +99,7 @@ public class TextCriteriaUnitTests { equalTo(new BasicDBObjectBuilder().add("$search", "coffee").add("$caseSensitive", true).get())); } - /** - * @see DATAMONGO-1456 - */ - @Test + @Test // DATAMONGO-1456 public void diacriticSensitiveOperatorShouldBeSetCorrectly() { TextCriteria criteria = TextCriteria.forDefaultLanguage().matching("coffee").diacriticSensitive(true); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryTests.java index 94b0637ef..c8d28c611 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryTests.java @@ -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. @@ -104,10 +104,7 @@ public class TextQueryTests extends AbstractIntegrationTests { }); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldOnlyFindDocumentsMatchingAnyWordOfGivenQuery() { initWithDefaultDocuments(); @@ -117,10 +114,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result, hasItems(BAKE, COFFEE, CAKE)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldNotFindDocumentsWhenQueryDoesNotMatchAnyDocumentInIndex() { initWithDefaultDocuments(); @@ -129,10 +123,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result, hasSize(0)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldApplySortByScoreCorrectly() { initWithDefaultDocuments(); @@ -147,10 +138,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result.get(3), equalTo(CAKE)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldFindTextInAnyLanguage() { initWithDefaultDocuments(); @@ -159,10 +147,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result, hasItems(SPANISH_MILK, FRENCH_MILK)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldOnlyFindTextInSpecificLanguage() { initWithDefaultDocuments(); @@ -172,10 +157,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result.get(0), equalTo(SPANISH_MILK)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldNotFindDocumentsWithNegatedTerms() { initWithDefaultDocuments(); @@ -185,10 +167,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result, hasItems(BAKE, COFFEE)); } - /** - * @see DATAMONGO-976 - */ - @Test + @Test // DATAMONGO-976 public void shouldInlcudeScoreCorreclty() { initWithDefaultDocuments(); @@ -202,10 +181,7 @@ public class TextQueryTests extends AbstractIntegrationTests { } } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldApplyPhraseCorrectly() { initWithDefaultDocuments(); @@ -217,10 +193,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result, contains(MILK_AND_SUGAR)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldReturnEmptyListWhenNoDocumentsMatchGivenPhrase() { initWithDefaultDocuments(); @@ -231,10 +204,7 @@ public class TextQueryTests extends AbstractIntegrationTests { assertThat(result, empty()); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldApplyPaginationCorrectly() { initWithDefaultDocuments(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryUnitTests.java index 2a0fa9c0b..b71b3c4ee 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/TextQueryUnitTests.java @@ -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. @@ -32,34 +32,22 @@ public class TextQueryUnitTests { private static final String QUERY = "bake coffee cake"; private static final String LANGUAGE_SPANISH = "spanish"; - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldCreateQueryObjectCorrectly() { assertThat(new TextQuery(QUERY), isTextQuery().searchingFor(QUERY)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldIncludeLanguageInQueryObjectWhenNotNull() { assertThat(new TextQuery(QUERY, LANGUAGE_SPANISH), isTextQuery().searchingFor(QUERY).inLanguage(LANGUAGE_SPANISH)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldIncludeScoreFieldCorrectly() { assertThat(new TextQuery(QUERY).includeScore(), isTextQuery().searchingFor(QUERY).returningScore()); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldNotOverrideExistingProjections() { TextQuery query = new TextQuery(TextCriteria.forDefaultLanguage().matching(QUERY)).includeScore(); @@ -68,18 +56,12 @@ public class TextQueryUnitTests { assertThat(query, isTextQuery().searchingFor(QUERY).returningScore().includingField("foo")); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldIncludeSortingByScoreCorrectly() { assertThat(new TextQuery(QUERY).sortByScore(), isTextQuery().searchingFor(QUERY).returningScore().sortingByScore()); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldNotOverrideExistingSort() { TextQuery query = new TextQuery(QUERY); @@ -90,10 +72,7 @@ public class TextQueryUnitTests { isTextQuery().searchingFor(QUERY).returningScore().sortingByScore().sortingBy("foo", Direction.DESC)); } - /** - * @see DATAMONGO-850 - */ - @Test + @Test // DATAMONGO-850 public void shouldUseCustomFieldnameForScoring() { TextQuery query = new TextQuery(QUERY).includeScore("customFieldForScore").sortByScore(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/UpdateTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/UpdateTests.java index 47cc8fee9..1325bb800 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/UpdateTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/UpdateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 the original author or authors. + * Copyright 2010-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. @@ -104,10 +104,7 @@ public class UpdateTests { is("{ \"$pushAll\" : { \"authors\" : [ { \"name\" : \"Sven\"} , { \"name\" : \"Maria\"}]}}")); } - /** - * @see DATAMONGO-354 - */ - @Test + @Test // DATAMONGO-354 public void testMultiplePushAllShouldBePossibleWhenUsingDifferentFields() { Map m1 = Collections.singletonMap("name", "Sven"); @@ -177,78 +174,54 @@ public class UpdateTests { is("{ \"$inc\" : { \"size\" : 1} , \"$set\" : { \"directory\" : \"/Users/Test/Desktop\"}}")); } - /** - * @see DATAMONGO-630 - */ - @Test + @Test // DATAMONGO-630 public void testSetOnInsert() { Update u = new Update().setOnInsert("size", 1); assertThat(u.getUpdateObject().toString(), is("{ \"$setOnInsert\" : { \"size\" : 1}}")); } - /** - * @see DATAMONGO-630 - */ - @Test + @Test // DATAMONGO-630 public void testSetOnInsertSetOnInsert() { Update u = new Update().setOnInsert("size", 1).setOnInsert("count", 1); assertThat(u.getUpdateObject().toString(), is("{ \"$setOnInsert\" : { \"size\" : 1 , \"count\" : 1}}")); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnTrueWhenMultiFieldOperationAddedForField() { Update update = new Update().set("foo", "bar"); assertThat(update.modifies("foo"), is(true)); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnFalseWhenMultiFieldOperationAddedForField() { Update update = new Update().set("foo", "bar"); assertThat(update.modifies("oof"), is(false)); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnTrueWhenSingleFieldOperationAddedForField() { Update update = new Update().pullAll("foo", new Object[] { "bar" }); assertThat(update.modifies("foo"), is(true)); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnFalseWhenSingleFieldOperationAddedForField() { Update update = new Update().pullAll("foo", new Object[] { "bar" }); assertThat(update.modifies("oof"), is(false)); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnFalseWhenCalledOnEmptyUpdate() { assertThat(new Update().modifies("foo"), is(false)); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnTrueWhenUpdateWithKeyCreatedFromDbObject() { Update update = new Update().set("foo", "bar"); @@ -257,10 +230,7 @@ public class UpdateTests { assertThat(clone.modifies("foo"), is(true)); } - /** - * @see DATAMONGO-852 - */ - @Test + @Test // DATAMONGO-852 public void testUpdateAffectsFieldShouldReturnFalseWhenUpdateWithoutKeyCreatedFromDbObject() { Update update = new Update().set("foo", "bar"); @@ -269,34 +239,22 @@ public class UpdateTests { assertThat(clone.modifies("oof"), is(false)); } - /** - * @see DATAMONGO-853 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-853 public void testAddingMultiFieldOperationThrowsExceptionWhenCalledWithNullKey() { new Update().addMultiFieldOperation("$op", null, "exprected to throw IllegalArgumentException."); } - /** - * @see DATAMONGO-853 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-853 public void testAddingSingleFieldOperationThrowsExceptionWhenCalledWithNullKey() { new Update().addFieldOperation("$op", null, "exprected to throw IllegalArgumentException."); } - /** - * @see DATAMONGO-853 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-853 public void testCreatingUpdateWithNullKeyThrowsException() { Update.update(null, "value"); } - /** - * @see DATAMONGO-953 - */ - @Test + @Test // DATAMONGO-953 public void testEquality() { Update actualUpdate = new Update() // @@ -321,10 +279,7 @@ public class UpdateTests { assertThat(actualUpdate.hashCode(), is(equalTo(expectedUpdate.hashCode()))); } - /** - * @see DATAMONGO-953 - */ - @Test + @Test // DATAMONGO-953 public void testToString() { Update actualUpdate = new Update() // @@ -351,10 +306,7 @@ public class UpdateTests { + ", \"$pop\" : { \"authors\" : -1}}")); // } - /** - * @see DATAMONGO-944 - */ - @Test + @Test // DATAMONGO-944 public void getUpdateObjectShouldReturnCurrentDateCorrectlyForSingleFieldWhenUsingDate() { Update update = new Update().currentDate("foo"); @@ -362,10 +314,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$currentDate", new BasicDBObject("foo", true)).get())); } - /** - * @see DATAMONGO-944 - */ - @Test + @Test // DATAMONGO-944 public void getUpdateObjectShouldReturnCurrentDateCorrectlyForMultipleFieldsWhenUsingDate() { Update update = new Update().currentDate("foo").currentDate("bar"); @@ -373,10 +322,7 @@ public class UpdateTests { new BasicDBObjectBuilder().add("$currentDate", new BasicDBObject("foo", true).append("bar", true)).get())); } - /** - * @see DATAMONGO-944 - */ - @Test + @Test // DATAMONGO-944 public void getUpdateObjectShouldReturnCurrentDateCorrectlyForSingleFieldWhenUsingTimestamp() { Update update = new Update().currentTimestamp("foo"); @@ -384,10 +330,7 @@ public class UpdateTests { .add("$currentDate", new BasicDBObject("foo", new BasicDBObject("$type", "timestamp"))).get())); } - /** - * @see DATAMONGO-944 - */ - @Test + @Test // DATAMONGO-944 public void getUpdateObjectShouldReturnCurrentDateCorrectlyForMultipleFieldsWhenUsingTimestamp() { Update update = new Update().currentTimestamp("foo").currentTimestamp("bar"); @@ -398,10 +341,7 @@ public class UpdateTests { .get())); } - /** - * @see DATAMONGO-944 - */ - @Test + @Test // DATAMONGO-944 public void getUpdateObjectShouldReturnCurrentDateCorrectlyWhenUsingMixedDateAndTimestamp() { Update update = new Update().currentDate("foo").currentTimestamp("bar"); @@ -411,28 +351,19 @@ public class UpdateTests { .get())); } - /** - * @see DATAMONGO-1002 - */ - @Test + @Test // DATAMONGO-1002 public void toStringWorksForUpdateWithComplexObject() { Update update = new Update().addToSet("key", new DateTime()); assertThat(update.toString(), is(notNullValue())); } - /** - * @see DATAMONGO-1097 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1097 public void multiplyShouldThrowExceptionForNullMultiplier() { new Update().multiply("key", null); } - /** - * @see DATAMONGO-1097 - */ - @Test + @Test // DATAMONGO-1097 public void multiplyShouldAddMultiplierAsItsDoubleValue() { Update update = new Update().multiply("key", 10); @@ -441,10 +372,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$mul", new BasicDBObject("key", 10D)).get())); } - /** - * @see DATAMONGO-1101 - */ - @Test + @Test // DATAMONGO-1101 public void getUpdateObjectShouldReturnCorrectRepresentationForBitwiseAnd() { Update update = new Update().bitwise("key").and(10L); @@ -453,10 +381,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$bit", new BasicDBObject("key", new BasicDBObject("and", 10L))).get())); } - /** - * @see DATAMONGO-1101 - */ - @Test + @Test // DATAMONGO-1101 public void getUpdateObjectShouldReturnCorrectRepresentationForBitwiseOr() { Update update = new Update().bitwise("key").or(10L); @@ -465,10 +390,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$bit", new BasicDBObject("key", new BasicDBObject("or", 10L))).get())); } - /** - * @see DATAMONGO-1101 - */ - @Test + @Test // DATAMONGO-1101 public void getUpdateObjectShouldReturnCorrectRepresentationForBitwiseXor() { Update update = new Update().bitwise("key").xor(10L); @@ -477,18 +399,12 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$bit", new BasicDBObject("key", new BasicDBObject("xor", 10L))).get())); } - /** - * @see DATAMONGO-943 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-943 public void pushShouldThrowExceptionWhenGivenNegativePosition() { new Update().push("foo").atPosition(-1).each("booh"); } - /** - * @see DATAMONGO-1346 - */ - @Test + @Test // DATAMONGO-1346 public void registersMultiplePullAllClauses() { Update update = new Update(); @@ -503,26 +419,17 @@ public class UpdateTests { assertThat(pullAll.get("field2"), is(notNullValue())); } - /** - * @see DATAMONGO-1404 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1404 public void maxShouldThrowExceptionForNullMultiplier() { new Update().max("key", null); } - /** - * @see DATAMONGO-1404 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-1404 public void minShouldThrowExceptionForNullMultiplier() { new Update().min("key", null); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void getUpdateObjectShouldReturnCorrectRepresentationForMax() { Update update = new Update().max("key", 10); @@ -531,10 +438,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$max", new BasicDBObject("key", 10)).get())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void getUpdateObjectShouldReturnCorrectRepresentationForMin() { Update update = new Update().min("key", 10); @@ -543,10 +447,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$min", new BasicDBObject("key", 10)).get())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void shouldSuppressPreviousValueForMax() { Update update = new Update().max("key", 10); @@ -556,10 +457,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$max", new BasicDBObject("key", 99)).get())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void shouldSuppressPreviousValueForMin() { Update update = new Update().min("key", 10); @@ -569,10 +467,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$min", new BasicDBObject("key", 99)).get())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void getUpdateObjectShouldReturnCorrectDateRepresentationForMax() { Date date = new Date(); @@ -582,10 +477,7 @@ public class UpdateTests { equalTo(new BasicDBObjectBuilder().add("$max", new BasicDBObject("key", date)).get())); } - /** - * @see DATAMONGO-1404 - */ - @Test + @Test // DATAMONGO-1404 public void getUpdateObjectShouldReturnCorrectDateRepresentationForMin() { Date date = new Date(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/ExecutableMongoScriptUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/ExecutableMongoScriptUnitTests.java index a8fda1fad..50142e3dc 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/ExecutableMongoScriptUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/ExecutableMongoScriptUnitTests.java @@ -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. @@ -31,10 +31,7 @@ public class ExecutableMongoScriptUnitTests { public @Rule ExpectedException expectedException = ExpectedException.none(); - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void constructorShouldThrowExceptionWhenRawScriptIsNull() { expectException(IllegalArgumentException.class, "must not be", "null"); @@ -42,10 +39,7 @@ public class ExecutableMongoScriptUnitTests { new ExecutableMongoScript(null); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void constructorShouldThrowExceptionWhenRawScriptIsEmpty() { expectException(IllegalArgumentException.class, "must not be", "empty"); @@ -53,10 +47,7 @@ public class ExecutableMongoScriptUnitTests { new ExecutableMongoScript(""); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void getCodeShouldReturnCodeRepresentationOfRawScript() { String jsFunction = "function(x) { return x; }"; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/NamedMongoScriptUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/NamedMongoScriptUnitTests.java index 32803881d..e22918a25 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/NamedMongoScriptUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/script/NamedMongoScriptUnitTests.java @@ -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. @@ -29,34 +29,22 @@ import org.junit.Test; */ public class NamedMongoScriptUnitTests { - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void shouldThrowExceptionWhenScriptNameIsNull() { new NamedMongoScript(null, "return 1;"); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void shouldThrowExceptionWhenScriptNameIsEmptyString() { new NamedMongoScript("", "return 1"); } - /** - * @see DATAMONGO-479 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-479 public void shouldThrowExceptionWhenRawScriptIsEmptyString() { new NamedMongoScript("foo", ""); } - /** - * @see DATAMONGO-479 - */ - @Test + @Test // DATAMONGO-479 public void getCodeShouldReturnCodeRepresentationOfRawScript() { String jsFunction = "function(x) { return x; }"; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/spel/ExpressionNodeUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/spel/ExpressionNodeUnitTests.java index 0f6d4b9b0..fce53fb05 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/spel/ExpressionNodeUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/spel/ExpressionNodeUnitTests.java @@ -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. @@ -36,7 +36,6 @@ import org.springframework.expression.spel.ast.OpPlus; /** * Unit tests for {@link ExpressionNode}. * - * @see DATAMONGO-774 * @author Oliver Gierke */ @RunWith(MockitoJUnitRunner.class) @@ -56,7 +55,7 @@ public class ExpressionNodeUnitTests { this.operators = Arrays.asList(minus, plus, divide, multiply); } - @Test + @Test // DATAMONGO-774 public void createsOperatorNodeForOperations() { for (SpelNode operator : operators) { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/gridfs/GridFsTemplateIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/gridfs/GridFsTemplateIntegrationTests.java index 6803069c6..1f2fed1d0 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/gridfs/GridFsTemplateIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/gridfs/GridFsTemplateIntegrationTests.java @@ -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. @@ -61,10 +61,7 @@ public class GridFsTemplateIntegrationTests { operations.delete(null); } - /** - * @see DATAMONGO-6 - */ - @Test + @Test // DATAMONGO-6 public void storesAndFindsSimpleDocument() throws IOException { GridFSFile reference = operations.store(resource.getInputStream(), "foo.xml"); @@ -74,10 +71,7 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(0), reference); } - /** - * @see DATAMONGO-6 - */ - @Test + @Test // DATAMONGO-6 public void writesMetadataCorrectly() throws IOException { DBObject metadata = new BasicDBObject("key", "value"); @@ -88,10 +82,7 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(0), reference); } - /** - * @see DATAMONGO-6 - */ - @Test + @Test // DATAMONGO-6 public void marshalsComplexMetadata() throws IOException { Metadata metadata = new Metadata(); @@ -103,10 +94,7 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(0), reference); } - /** - * @see DATAMONGO-6 - */ - @Test + @Test // DATAMONGO-6 public void findsFilesByResourcePattern() throws IOException { GridFSFile reference = operations.store(resource.getInputStream(), "foo.xml"); @@ -118,10 +106,7 @@ public class GridFsTemplateIntegrationTests { assertThat(resources[0].getContentType(), is(reference.getContentType())); } - /** - * @see DATAMONGO-6 - */ - @Test + @Test // DATAMONGO-6 public void findsFilesByResourceLocation() throws IOException { GridFSFile reference = operations.store(resource.getInputStream(), "foo.xml"); @@ -133,10 +118,7 @@ public class GridFsTemplateIntegrationTests { assertThat(resources[0].getContentType(), is(reference.getContentType())); } - /** - * @see DATAMONGO-503 - */ - @Test + @Test // DATAMONGO-503 public void storesContentType() throws IOException { GridFSFile reference = operations.store(resource.getInputStream(), "foo2.xml", "application/xml"); @@ -146,10 +128,7 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(0), reference); } - /** - * @see DATAMONGO-534 - */ - @Test + @Test // DATAMONGO-534 public void considersSortWhenQueryingFiles() throws IOException { GridFSFile second = operations.store(resource.getInputStream(), "foo.xml"); @@ -165,10 +144,7 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(2), third); } - /** - * @see DATAMONGO-534 - */ - @Test + @Test // DATAMONGO-534 public void queryingWithNullQueryReturnsAllFiles() throws IOException { GridFSFile reference = operations.store(resource.getInputStream(), "foo.xml"); @@ -179,18 +155,12 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(0), reference); } - /** - * @see DATAMONGO-813 - */ - @Test + @Test // DATAMONGO-813 public void getResourceShouldReturnNullForNonExistingResource() { assertThat(operations.getResource("doesnotexist"), is(nullValue())); } - /** - * @see DATAMONGO-809 - */ - @Test + @Test // DATAMONGO-809 public void storesAndFindsSimpleDocumentWithMetadataDBObject() throws IOException { DBObject metadata = new BasicDBObject("key", "value"); @@ -202,10 +172,7 @@ public class GridFsTemplateIntegrationTests { assertSame(result.get(0), reference); } - /** - * @see DATAMONGO-809 - */ - @Test + @Test // DATAMONGO-809 public void storesAndFindsSimpleDocumentWithMetadataObject() throws IOException { Metadata metadata = new Metadata(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/monitor/MongoMonitorIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/monitor/MongoMonitorIntegrationTests.java index da9290058..5d07d58ba 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/monitor/MongoMonitorIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/monitor/MongoMonitorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-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. @@ -15,11 +15,11 @@ */ package org.springframework.data.mongodb.monitor; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -import java.net.UnknownHostException; - +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; + +import java.net.UnknownHostException; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -28,19 +28,19 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.Assert; import org.springframework.util.StringUtils; -import com.mongodb.Mongo; - +import com.mongodb.Mongo; + /** * This test class assumes that you are already running the MongoDB server. * * @author Mark Pollack - * @author Thomas Darimont + * @author Thomas Darimont */ @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:infrastructure.xml") +@ContextConfiguration("classpath:infrastructure.xml") public class MongoMonitorIntegrationTests { - @Autowired Mongo mongo; + @Autowired Mongo mongo; @Test public void serverInfo() { @@ -49,29 +49,25 @@ public class MongoMonitorIntegrationTests { Assert.isTrue(StringUtils.hasText("1.")); } - /** - * @throws UnknownHostException - * @see DATAMONGO-685 - */ - @Test - public void getHostNameShouldReturnServerNameReportedByMongo() throws UnknownHostException { - - ServerInfo serverInfo = new ServerInfo(mongo); - - String hostName = null; - try { - hostName = serverInfo.getHostName(); - } catch (UnknownHostException e) { - throw e; - } - - assertThat(hostName, is(notNullValue())); - assertThat(hostName, is("127.0.0.1")); - } - + @Test // DATAMONGO-685 + public void getHostNameShouldReturnServerNameReportedByMongo() throws UnknownHostException { + + ServerInfo serverInfo = new ServerInfo(mongo); + + String hostName = null; + try { + hostName = serverInfo.getHostName(); + } catch (UnknownHostException e) { + throw e; + } + + assertThat(hostName, is(notNullValue())); + assertThat(hostName, is("127.0.0.1")); + } + @Test public void operationCounters() { OperationCounters operationCounters = new OperationCounters(mongo); operationCounters.getInsertCount(); } -} +} diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/AbstractPersonRepositoryIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/AbstractPersonRepositoryIntegrationTests.java index 07ed39b7c..7544ae64d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/AbstractPersonRepositoryIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/AbstractPersonRepositoryIntegrationTests.java @@ -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. @@ -326,10 +326,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(page, hasItems(carter, stefan)); } - /** - * @see DATADOC-136 - */ - @Test + @Test // DATADOC-136 public void findsPeopleBySexCorrectly() { List females = repository.findBySex(Sex.FEMALE); @@ -337,10 +334,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(females.get(0), is(alicia)); } - /** - * @see DATAMONGO-446 - */ - @Test + @Test // DATAMONGO-446 public void findsPeopleBySexPaginated() { List males = repository.findBySex(Sex.MALE, new PageRequest(0, 2)); @@ -354,10 +348,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItem(dave)); } - /** - * @see DATADOC-190 - */ - @Test + @Test // DATADOC-190 public void existsWorksCorrectly() { assertThat(repository.exists(dave.getId()), is(true)); } @@ -373,10 +364,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { repository.save(daveSyer); } - /** - * @see DATADOC-236 - */ - @Test + @Test // DATADOC-236 public void findsPeopleByLastnameAndOrdersCorrectly() { List result = repository.findByLastnameOrderByFirstnameAsc("Matthews"); assertThat(result.size(), is(2)); @@ -384,10 +372,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.get(1), is(oliver)); } - /** - * @see DATADOC-236 - */ - @Test + @Test // DATADOC-236 public void appliesStaticAndDynamicSorting() { List result = repository.findByFirstnameLikeOrderByLastnameAsc("*e*", new Sort("age")); assertThat(result.size(), is(5)); @@ -425,10 +410,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(results.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS)); } - /** - * @see DATAMONGO-323 - */ - @Test + @Test // DATAMONGO-323 public void considersSortForAnnotatedQuery() { List result = repository.findByAgeLessThan(60, new Sort("firstname")); @@ -443,10 +425,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.get(6), is(stefan)); } - /** - * @see DATAMONGO-347 - */ - @Test + @Test // DATAMONGO-347 public void executesQueryWithDBRefReferenceCorrectly() { operations.remove(new org.springframework.data.mongodb.core.query.Query(), User.class); @@ -464,10 +443,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItem(dave)); } - /** - * @see DATAMONGO-425 - */ - @Test + @Test // DATAMONGO-425 public void bindsDateParameterForLessThanPredicateCorrectly() { List result = repository.findByCreatedAtLessThan(boyd.createdAt); @@ -475,10 +451,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItems(dave, oliver, carter)); } - /** - * @see DATAMONGO-425 - */ - @Test + @Test // DATAMONGO-425 public void bindsDateParameterForGreaterThanPredicateCorrectly() { List result = repository.findByCreatedAtGreaterThan(carter.createdAt); @@ -486,10 +459,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItems(boyd, stefan, leroi, alicia)); } - /** - * @see DATAMONGO-427 - */ - @Test + @Test // DATAMONGO-427 public void bindsDateParameterToBeforePredicateCorrectly() { List result = repository.findByCreatedAtBefore(boyd.createdAt); @@ -497,10 +467,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItems(dave, oliver, carter)); } - /** - * @see DATAMONGO-427 - */ - @Test + @Test // DATAMONGO-427 public void bindsDateParameterForAfterPredicateCorrectly() { List result = repository.findByCreatedAtAfter(carter.createdAt); @@ -508,20 +475,14 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItems(boyd, stefan, leroi, alicia)); } - /** - * @see DATAMONGO-425 - */ - @Test + @Test // DATAMONGO-425 public void bindsDateParameterForManuallyDefinedQueryCorrectly() { List result = repository.findByCreatedAtLessThanManually(boyd.createdAt); assertThat(result.isEmpty(), is(false)); } - /** - * @see DATAMONGO-472 - */ - @Test + @Test // DATAMONGO-472 public void findsPeopleUsingNotPredicate() { List result = repository.findByLastnameNot("Matthews"); @@ -529,10 +490,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasSize(5)); } - /** - * @see DATAMONGO-521 - */ - @Test + @Test // DATAMONGO-521 public void executesAndQueryCorrectly() { List result = repository.findByFirstnameAndLastname("Dave", "Matthews"); @@ -546,10 +504,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItem(oliver)); } - /** - * @see DATAMONGO-600 - */ - @Test + @Test // DATAMONGO-600 public void readsDocumentsWithNestedPolymorphismCorrectly() { UsernameAndPassword usernameAndPassword = new UsernameAndPassword(); @@ -565,52 +520,34 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItem(dave)); } - /** - * @see DATAMONGO-636 - */ - @Test + @Test // DATAMONGO-636 public void executesDerivedCountProjection() { assertThat(repository.countByLastname("Matthews"), is(2L)); } - /** - * @see DATAMONGO-636 - */ - @Test + @Test // DATAMONGO-636 public void executesDerivedCountProjectionToInt() { assertThat(repository.countByFirstname("Oliver August"), is(1)); } - /** - * @see DATAMONGO-636 - */ - @Test + @Test // DATAMONGO-636 public void executesAnnotatedCountProjection() { assertThat(repository.someCountQuery("Matthews"), is(2L)); } - /** - * @see DATAMONGO-1454 - */ - @Test + @Test // DATAMONGO-1454 public void executesDerivedExistsProjectionToBoolean() { assertThat(repository.existsByFirstname("Oliver August"), is(true)); assertThat(repository.existsByFirstname("Hans Peter"), is(false)); } - /** - * @see DATAMONGO-1454 - */ - @Test + @Test // DATAMONGO-1454 public void executesAnnotatedExistProjection() { assertThat(repository.someExistQuery("Matthews"), is(true)); } - /** - * @see DATAMONGO-701 - */ - @Test + @Test // DATAMONGO-701 public void executesDerivedStartsWithQueryCorrectly() { List result = repository.findByLastnameStartsWith("Matt"); @@ -618,10 +555,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItems(dave, oliver)); } - /** - * @see DATAMONGO-701 - */ - @Test + @Test // DATAMONGO-701 public void executesDerivedEndsWithQueryCorrectly() { List result = repository.findByLastnameEndsWith("thews"); @@ -629,10 +563,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItems(dave, oliver)); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void executesGeoPageQueryForWithPageRequestForPageInBetween() { Point farAway = new Point(-73.9, 40.7); @@ -657,10 +588,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(results.getAverageDistance().getNormalizedValue(), is(0.0)); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void executesGeoPageQueryForWithPageRequestForPageAtTheEnd() { Point point = new Point(-73.99171, 40.738868); @@ -680,10 +608,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(results.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS)); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void executesGeoPageQueryForWithPageRequestForJustOneElement() { Point point = new Point(-73.99171, 40.738868); @@ -700,10 +625,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(results.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS)); } - /** - * @see DATAMONGO-445 - */ - @Test + @Test // DATAMONGO-445 public void executesGeoPageQueryForWithPageRequestForJustOneElementEmptyPage() { dave.setLocation(new Point(-73.99171, 40.738868)); @@ -719,10 +641,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(results.getAverageDistance().getMetric(), is((Metric) Metrics.KILOMETERS)); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void findByFirstNameIgnoreCase() { List result = repository.findByFirstnameIgnoreCase("dave"); @@ -731,10 +650,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.get(0), is(dave)); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void findByFirstnameNotIgnoreCase() { List result = repository.findByFirstnameNotIgnoreCase("dave"); @@ -743,10 +659,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, not(hasItem(dave))); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void findByFirstnameStartingWithIgnoreCase() { List result = repository.findByFirstnameStartingWithIgnoreCase("da"); @@ -754,10 +667,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.get(0), is(dave)); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void findByFirstnameEndingWithIgnoreCase() { List result = repository.findByFirstnameEndingWithIgnoreCase("VE"); @@ -765,10 +675,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.get(0), is(dave)); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void findByFirstnameContainingIgnoreCase() { List result = repository.findByFirstnameContainingIgnoreCase("AV"); @@ -776,10 +683,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.get(0), is(dave)); } - /** - * @see DATAMONGO-870 - */ - @Test + @Test // DATAMONGO-870 public void findsSliceOfPersons() { Slice result = repository.findByAgeGreaterThan(40, new PageRequest(0, 2, Direction.DESC, "firstname")); @@ -787,10 +691,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.hasNext(), is(true)); } - /** - * @see DATAMONGO-871 - */ - @Test + @Test // DATAMONGO-871 public void findsPersonsByFirstnameAsArray() { Person[] result = repository.findByThePersonsFirstnameAsArray("Leroi"); @@ -799,10 +700,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, is(arrayContaining(leroi))); } - /** - * @see DATAMONGO-821 - */ - @Test + @Test // DATAMONGO-821 public void findUsingAnnotatedQueryOnDBRef() { operations.remove(new org.springframework.data.mongodb.core.query.Query(), User.class); @@ -820,10 +718,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getContent().get(0), is(alicia)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByShouldReturnListOfDeletedElementsWhenRetunTypeIsCollectionLike() { List result = repository.deleteByLastname("Beauford"); @@ -832,10 +727,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByShouldRemoveElementsMatchingDerivedQuery() { repository.deleteByLastname("Beauford"); @@ -843,34 +735,22 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(operations.count(new BasicQuery("{'lastname':'Beauford'}"), Person.class), is(0L)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByShouldReturnNumberOfDocumentsRemovedIfReturnTypeIsLong() { assertThat(repository.deletePersonByLastname("Beauford"), is(1L)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByShouldReturnZeroInCaseNoDocumentHasBeenRemovedAndReturnTypeIsNumber() { assertThat(repository.deletePersonByLastname("dorfuaeB"), is(0L)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByShouldReturnEmptyListInCaseNoDocumentHasBeenRemovedAndReturnTypeIsCollectionLike() { assertThat(repository.deleteByLastname("dorfuaeB"), empty()); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByUsingAnnotatedQueryShouldReturnListOfDeletedElementsWhenRetunTypeIsCollectionLike() { List result = repository.removeByLastnameUsingAnnotatedQuery("Beauford"); @@ -879,10 +759,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByUsingAnnotatedQueryShouldRemoveElementsMatchingDerivedQuery() { repository.removeByLastnameUsingAnnotatedQuery("Beauford"); @@ -890,18 +767,12 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(operations.count(new BasicQuery("{'lastname':'Beauford'}"), Person.class), is(0L)); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void deleteByUsingAnnotatedQueryShouldReturnNumberOfDocumentsRemovedIfReturnTypeIsLong() { assertThat(repository.removePersonByLastnameUsingAnnotatedQuery("Beauford"), is(1L)); } - /** - * @see DATAMONGO-893 - */ - @Test + @Test // DATAMONGO-893 public void findByNestedPropertyInCollectionShouldFindMatchingDocuments() { Person p = new Person("Mary", "Poppins"); @@ -915,10 +786,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getContent(), hasSize(1)); } - /** - * @see DATAMONGO-745 - */ - @Test + @Test // DATAMONGO-745 public void findByCustomQueryFirstnamesInListAndLastname() { repository.save(new Person("foo", "bar")); @@ -934,10 +802,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getTotalElements(), is(3L)); } - /** - * @see DATAMONGO-745 - */ - @Test + @Test // DATAMONGO-745 public void findByCustomQueryLastnameAndStreetInList() { repository.save(new Person("foo", "bar").withAddress(new Address("street1", "1", "SB"))); @@ -954,10 +819,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { } - /** - * @see DATAMONGO-950 - */ - @Test + @Test // DATAMONGO-950 public void shouldLimitCollectionQueryToMaxResultsWhenPresent() { repository.save(Arrays.asList(new Person("Bob-1", "Dylan"), new Person("Bob-2", "Dylan"), @@ -966,10 +828,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.size(), is(3)); } - /** - * @see DATAMONGO-950, DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-950, DATAMONGO-1464 public void shouldNotLimitPagedQueryWhenPageRequestWithinBounds() { repository.save(Arrays.asList(new Person("Bob-1", "Dylan"), new Person("Bob-2", "Dylan"), @@ -979,10 +838,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getTotalElements(), is(3L)); } - /** - * @see DATAMONGO-950 - */ - @Test + @Test // DATAMONGO-950 public void shouldLimitPagedQueryWhenPageRequestExceedsUpperBoundary() { repository.save(Arrays.asList(new Person("Bob-1", "Dylan"), new Person("Bob-2", "Dylan"), @@ -991,10 +847,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getContent().size(), is(1)); } - /** - * @see DATAMONGO-950, DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-950, DATAMONGO-1464 public void shouldReturnEmptyWhenPageRequestedPageIsTotallyOutOfScopeForLimit() { repository.save(Arrays.asList(new Person("Bob-1", "Dylan"), new Person("Bob-2", "Dylan"), @@ -1004,10 +857,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getTotalElements(), is(3L)); } - /** - * @see DATAMONGO-996, DATAMONGO-950, DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-996, DATAMONGO-950, DATAMONGO-1464 public void gettingNonFirstPageWorksWithoutLimitBeingSet() { Page slice = repository.findByLastnameLike("Matthews", new PageRequest(1, 1)); @@ -1018,13 +868,8 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(slice.getTotalElements(), is(2L)); } - /** - * Ignored for now as this requires Querydsl 3.4.1 to succeed. - * - * @see DATAMONGO-972 - */ - @Test - @Ignore + @Test // DATAMONGO-972 + @Ignore("Ignored for now as this requires Querydsl 3.4.1 to succeed.") public void shouldExecuteFindOnDbRefCorrectly() { operations.remove(new org.springframework.data.mongodb.core.query.Query(), User.class); @@ -1040,18 +885,12 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(repository.findOne(QPerson.person.creator.eq(user)), is(dave)); } - /** - * @see DATAMONGO-969 - */ - @Test + @Test // DATAMONGO-969 public void shouldFindPersonsWhenUsingQueryDslPerdicatedOnIdProperty() { assertThat(repository.findAll(person.id.in(Arrays.asList(dave.id, carter.id))), containsInAnyOrder(dave, carter)); } - /** - * @see DATAMONGO-1030 - */ - @Test + @Test // DATAMONGO-1030 public void executesSingleEntityQueryWithProjectionCorrectly() { PersonSummary result = repository.findSummaryByLastname("Beauford"); @@ -1061,10 +900,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.lastname, is("Beauford")); } - /** - * @see DATAMONGO-1057 - */ - @Test + @Test // DATAMONGO-1057 public void sliceShouldTraverseElementsWithoutSkippingOnes() { repository.deleteAll(); @@ -1084,10 +920,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(slice, contains(persons.subList(20, 40).toArray())); } - /** - * @see DATAMONGO-1072 - */ - @Test + @Test // DATAMONGO-1072 public void shouldBindPlaceholdersUsedAsKeysCorrectly() { List persons = repository.findByKeyValue("firstname", alicia.getFirstname()); @@ -1096,10 +929,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(persons, hasItem(alicia)); } - /** - * @see DATAMONGO-1105 - */ - @Test + @Test // DATAMONGO-1105 public void returnsOrderedResultsForQuerydslOrderSpecifier() { Iterable result = repository.findAll(person.firstname.asc()); @@ -1107,10 +937,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, contains(alicia, boyd, carter, dave, leroi, oliver, stefan)); } - /** - * @see DATAMONGO-1085 - */ - @Test + @Test // DATAMONGO-1085 public void shouldSupportSortingByQueryDslOrderSpecifier() { repository.deleteAll(); @@ -1133,10 +960,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.iterator().next().getFirstname(), is(persons.get(2).getFirstname())); } - /** - * @see DATAMONGO-1085 - */ - @Test + @Test // DATAMONGO-1085 public void shouldSupportSortingWithQSortByQueryDslOrderSpecifier() throws Exception { repository.deleteAll(); @@ -1158,10 +982,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.iterator().next().getFirstname(), is("Siggi 2")); } - /** - * @see DATAMONGO-1085 - */ - @Test + @Test // DATAMONGO-1085 public void shouldSupportSortingWithQSort() throws Exception { repository.deleteAll(); @@ -1182,10 +1003,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.iterator().next().getFirstname(), is("Siggi 2")); } - /** - * @see DATAMONGO-1165 - */ - @Test + @Test // DATAMONGO-1165 public void shouldAllowReturningJava8StreamInCustomQuery() throws Exception { Stream result = repository.findByCustomQueryWithStreamingCursorByFirstnames(Arrays.asList("Dave")); @@ -1197,10 +1015,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { } } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void executesGeoNearQueryForResultsCorrectlyWhenGivenMinAndMaxDistance() { Point point = new Point(-73.99171, 40.738868); @@ -1213,10 +1028,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(results.getContent().isEmpty(), is(false)); } - /** - * @see DATAMONGO-990 - */ - @Test + @Test // DATAMONGO-990 public void shouldFindByFirstnameForSpELExpressionWithParameterIndexOnly() { List users = repository.findWithSpelByFirstnameForSpELExpressionWithParameterIndexOnly("Dave"); @@ -1225,10 +1037,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(users.get(0), is(dave)); } - /** - * @see DATAMONGO-990 - */ - @Test + @Test // DATAMONGO-990 public void shouldFindByFirstnameAndCurrentUserWithCustomQuery() { SampleSecurityContextHolder.getCurrent().setPrincipal(dave); @@ -1238,10 +1047,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(users.get(0), is(dave)); } - /** - * @see DATAMONGO-990 - */ - @Test + @Test // DATAMONGO-990 public void shouldFindByFirstnameForSpELExpressionWithParameterVariableOnly() { List users = repository.findWithSpelByFirstnameForSpELExpressionWithParameterVariableOnly("Dave"); @@ -1250,10 +1056,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(users.get(0), is(dave)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findByExampleShouldResolveStuffCorrectly() { Person sample = new Person(); @@ -1268,10 +1071,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.getNumberOfElements(), is(2)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldResolveStuffCorrectly() { Person sample = new Person(); @@ -1286,10 +1086,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result.size(), is(2)); } - /** - * @see DATAMONGO-1425 - */ - @Test + @Test // DATAMONGO-1425 public void findsPersonsByFirstnameNotContains() throws Exception { List result = repository.findByFirstnameNotContains("Boyd"); @@ -1297,10 +1094,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, not(hasItem(boyd))); } - /** - * @see DATAMONGO-1425 - */ - @Test + @Test // DATAMONGO-1425 public void findBySkillsContains() throws Exception { List result = repository.findBySkillsContains(Arrays.asList("Drums")); @@ -1308,10 +1102,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, hasItem(carter)); } - /** - * @see DATAMONGO-1425 - */ - @Test + @Test // DATAMONGO-1425 public void findBySkillsNotContains() throws Exception { List result = repository.findBySkillsNotContains(Arrays.asList("Drums")); @@ -1319,10 +1110,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, not(hasItem(carter))); } - /* - * @see DATAMONGO-1424 - */ - @Test + @Test // DATAMONGO-1424 public void findsPersonsByFirstnameNotLike() throws Exception { List result = repository.findByFirstnameNotLike("Bo*"); @@ -1330,18 +1118,12 @@ public abstract class AbstractPersonRepositoryIntegrationTests { assertThat(result, not(hasItem(boyd))); } - /** - * @see DATAMONGO-1539 - */ - @Test + @Test // DATAMONGO-1539 public void countsPersonsByFirstname() { assertThat(repository.countByThePersonsFirstname("Dave"), is(1L)); } - /** - * @see DATAMONGO-1539 - */ - @Test + @Test // DATAMONGO-1539 public void deletesPersonsByFirstname() { repository.deleteByThePersonsFirstname("Dave"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ComplexIdRepositoryIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ComplexIdRepositoryIntegrationTests.java index c788e4524..f2ee84c26 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ComplexIdRepositoryIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ComplexIdRepositoryIntegrationTests.java @@ -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. @@ -82,10 +82,7 @@ public class ComplexIdRepositoryIntegrationTests { userWithId.id = id; } - /** - * @see DATAMONGO-1078 - */ - @Test + @Test // DATAMONGO-1078 public void annotatedFindQueryShouldWorkWhenUsingComplexId() { repo.save(userWithId); @@ -93,10 +90,7 @@ public class ComplexIdRepositoryIntegrationTests { assertThat(repo.getUserByComplexId(id), is(userWithId)); } - /** - * @see DATAMONGO-1078 - */ - @Test + @Test // DATAMONGO-1078 public void annotatedFindQueryShouldWorkWhenUsingComplexIdWithinCollection() { repo.save(userWithId); @@ -107,10 +101,7 @@ public class ComplexIdRepositoryIntegrationTests { assertThat(loaded, contains(userWithId)); } - /** - * @see DATAMONGO-1078 - */ - @Test + @Test // DATAMONGO-1078 public void findOneShouldWorkWhenUsingComplexId() { repo.save(userWithId); @@ -118,10 +109,7 @@ public class ComplexIdRepositoryIntegrationTests { assertThat(repo.findOne(id), is(userWithId)); } - /** - * @see DATAMONGO-1078 - */ - @Test + @Test // DATAMONGO-1078 public void findAllShouldWorkWhenUsingComplexId() { repo.save(userWithId); @@ -132,10 +120,7 @@ public class ComplexIdRepositoryIntegrationTests { assertThat(loaded, contains(userWithId)); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void composedAnnotationFindQueryShouldWorkWhenUsingComplexId() { repo.save(userWithId); @@ -143,10 +128,7 @@ public class ComplexIdRepositoryIntegrationTests { assertThat(repo.getUserUsingComposedAnnotationByComplexId(id), is(userWithId)); } - /** - * @see DATAMONGO-1373 - */ - @Test + @Test // DATAMONGO-1373 public void composedAnnotationFindMetaShouldWorkWhenUsingComplexId() { repo.save(userWithId); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ContactRepositoryIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ContactRepositoryIntegrationTests.java index 34722d709..e504e2254 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ContactRepositoryIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ContactRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 the original author or authors. + * Copyright 2010-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 ContactRepositoryIntegrationTests { assertTrue(repository.findOne(result.getId().toString()) instanceof Person); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findsContactByTypedExample() { Person person = repository.save(new Person("Oliver", "Gierke")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/MongoRepositoryTextSearchIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/MongoRepositoryTextSearchIntegrationTests.java index 05305d9a9..b3b439f37 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/MongoRepositoryTextSearchIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/MongoRepositoryTextSearchIntegrationTests.java @@ -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. @@ -88,10 +88,7 @@ public class MongoRepositoryTextSearchIntegrationTests { template.dropCollection(FullTextDocument.class); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void findAllByTextCriteriaShouldReturnMatchingDocuments() { initRepoWithDefaultDocuments(); @@ -102,10 +99,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(result, hasItems(PASSENGER_57, DEMOLITION_MAN)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void derivedFinderWithTextCriteriaReturnsCorrectResult() { initRepoWithDefaultDocuments(); @@ -123,10 +117,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(result, hasItems(blade)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void findByWithPaginationWorksCorrectlyWhenUsingTextCriteria() { initRepoWithDefaultDocuments(); @@ -140,10 +131,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(page.getContent().get(0), equalTo(DEMOLITION_MAN)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void findAllByTextCriteriaWithSortWorksCorrectly() { initRepoWithDefaultDocuments(); @@ -157,10 +145,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(result.get(0), equalTo(snipes)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void findByWithSortByScoreViaPageRequestTriggersSortingCorrectly() { initRepoWithDefaultDocuments(); @@ -174,10 +159,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(page.getContent().get(0), equalTo(snipes)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void findByWithSortViaPageRequestIgnoresTextScoreWhenSortedByOtherProperty() { initRepoWithDefaultDocuments(); @@ -191,10 +173,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(page.getContent().get(0), equalTo(PASSENGER_57)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void derivedSortForTextScorePropertyWorksCorrectly() { initRepoWithDefaultDocuments(); @@ -206,10 +185,7 @@ public class MongoRepositoryTextSearchIntegrationTests { assertThat(result.get(0), equalTo(snipes)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void derivedFinderMethodWithoutFullTextShouldNoCauseTroubleWhenHavingEntityWithTextScoreProperty() { initRepoWithDefaultDocuments(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepository.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepository.java index 849a673f1..42beb55ed 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepository.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 the original author or authors. + * Copyright 2010-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. @@ -77,9 +77,7 @@ public interface PersonRepository extends MongoRepository, Query @Query(value = "{ 'firstname' : ?0 }", fields = "{ 'firstname': 1, 'lastname': 1}") List findByThePersonsFirstname(String firstname); - /** - * @see DATAMONGO-871 - */ + // DATAMONGO-871 @Query(value = "{ 'firstname' : ?0 }") Person[] findByThePersonsFirstnameAsArray(String firstname); @@ -187,197 +185,125 @@ public interface PersonRepository extends MongoRepository, Query GeoResults findByLocationNear(Point point, Distance maxDistance); - /** - * @see DATAMONGO-1110 - */ + // DATAMONGO-1110 GeoResults findPersonByLocationNear(Point point, Range distance); GeoPage findByLocationNear(Point point, Distance maxDistance, Pageable pageable); List findByCreator(User user); - /** - * @see DATAMONGO-425 - */ + // DATAMONGO-425 List findByCreatedAtLessThan(Date date); - /** - * @see DATAMONGO-425 - */ + // DATAMONGO-425 List findByCreatedAtGreaterThan(Date date); - /** - * @see DATAMONGO-425 - */ + // DATAMONGO-425 @Query("{ 'createdAt' : { '$lt' : ?0 }}") List findByCreatedAtLessThanManually(Date date); - /** - * @see DATAMONGO-427 - */ + // DATAMONGO-427 List findByCreatedAtBefore(Date date); - /** - * @see DATAMONGO-427 - */ + // DATAMONGO-427 List findByCreatedAtAfter(Date date); - /** - * @see DATAMONGO-472 - * @param lastname - * @return - */ + // DATAMONGO-472 List findByLastnameNot(String lastname); - /** - * @see DATAMONGO-600 - * @param credentials - * @return - */ + // DATAMONGO-600 List findByCredentials(Credentials credentials); - /** - * @see DATAMONGO-636 - */ + // DATAMONGO-636 long countByLastname(String lastname); - /** - * @see DATAMONGO-636 - */ + // DATAMONGO-636 int countByFirstname(String firstname); - /** - * @see DATAMONGO-636 - */ + // DATAMONGO-636 @Query(value = "{ 'lastname' : ?0 }", count = true) long someCountQuery(String lastname); - /** - * @see DATAMONGO-1454 - */ + // DATAMONGO-1454 boolean existsByFirstname(String firstname); - /** - * @see DATAMONGO-1454 - */ + // DATAMONGO-1454 @ExistsQuery(value = "{ 'lastname' : ?0 }") boolean someExistQuery(String lastname); - /** - * @see DATAMONGO-770 - */ + // DATAMONGO-770 List findByFirstnameIgnoreCase(String firstName); - /** - * @see DATAMONGO-770 - */ + // DATAMONGO-770 List findByFirstnameNotIgnoreCase(String firstName); - /** - * @see DATAMONGO-770 - */ + // DATAMONGO-770 List findByFirstnameStartingWithIgnoreCase(String firstName); - /** - * @see DATAMONGO-770 - */ + // DATAMONGO-770 List findByFirstnameEndingWithIgnoreCase(String firstName); - /** - * @see DATAMONGO-770 - */ + // DATAMONGO-770 List findByFirstnameContainingIgnoreCase(String firstName); - /** - * @see DATAMONGO-870 - */ + // DATAMONGO-870 Slice findByAgeGreaterThan(int age, Pageable pageable); - /** - * @see DATAMONGO-821 - */ + // DATAMONGO-821 @Query("{ creator : { $exists : true } }") Page findByHavingCreator(Pageable page); - /** - * @see DATAMONGO-566 - */ + // DATAMONGO-566 List deleteByLastname(String lastname); - /** - * @see DATAMONGO-566 - */ + // DATAMONGO-566 Long deletePersonByLastname(String lastname); - /** - * @see DATAMONGO-566 - */ + // DATAMONGO-566 @Query(value = "{ 'lastname' : ?0 }", delete = true) List removeByLastnameUsingAnnotatedQuery(String lastname); - /** - * @see DATAMONGO-566 - */ + // DATAMONGO-566 @Query(value = "{ 'lastname' : ?0 }", delete = true) Long removePersonByLastnameUsingAnnotatedQuery(String lastname); - /** - * @see DATAMONGO-893 - */ + // DATAMONGO-893 Page findByAddressIn(List
address, Pageable page); - /** - * @see DATAMONGO-745 - */ + // DATAMONGO-745 @Query("{firstname:{$in:?0}, lastname:?1}") Page findByCustomQueryFirstnamesAndLastname(List firstnames, String lastname, Pageable page); - /** - * @see DATAMONGO-745 - */ + // DATAMONGO-745 @Query("{lastname:?0, address.street:{$in:?1}}") Page findByCustomQueryLastnameAndAddressStreetInList(String lastname, List streetNames, Pageable page); - /** - * @see DATAMONGO-950 - */ + // DATAMONGO-950 List findTop3ByLastnameStartingWith(String lastname); - /** - * @see DATAMONGO-950 - */ + // DATAMONGO-950 Page findTop3ByLastnameStartingWith(String lastname, Pageable pageRequest); - /** - * @see DATAMONGO-1030 - */ + // DATAMONGO-1030 PersonSummary findSummaryByLastname(String lastname); @Query("{ ?0 : ?1 }") List findByKeyValue(String key, String value); - /** - * @see DATAMONGO-1165 - */ + // DATAMONGO-1165 @Query("{ firstname : { $in : ?0 }}") Stream findByCustomQueryWithStreamingCursorByFirstnames(List firstnames); - /** - * @see DATAMONGO-990 - */ + // DATAMONGO-990 @Query("{ firstname : ?#{[0]}}") List findWithSpelByFirstnameForSpELExpressionWithParameterIndexOnly(String firstname); - /** - * @see DATAMONGO-990 - */ + // DATAMONGO-990 @Query("{ firstname : ?#{[0]}, email: ?#{principal.email} }") List findWithSpelByFirstnameAndCurrentUserWithCustomQuery(String firstname); - /** - * @see DATAMONGO-990 - */ + // DATAMONGO-990 @Query("{ firstname : :#{#firstname}}") List findWithSpelByFirstnameForSpELExpressionWithParameterVariableOnly(@Param("firstname") String firstname); @@ -385,20 +311,18 @@ public interface PersonRepository extends MongoRepository, Query * Returns the count of {@link Person} with the given firstname. Uses {@link CountQuery} annotation to define the * query to be executed. * - * @see DATAMONGO-1539 * @param firstname * @return */ - @CountQuery("{ 'firstname' : ?0 }") + @CountQuery("{ 'firstname' : ?0 }") // DATAMONGO-1539 long countByThePersonsFirstname(String firstname); /** * Deletes {@link Person} entities with the given firstname. Uses {@link DeleteQuery} annotation to define the query * to be executed. * - * @see DATAMONGO-1539 * @param firstname */ - @DeleteQuery("{ 'firstname' : ?0 }") + @DeleteQuery("{ 'firstname' : ?0 }") // DATAMONGO-1539 void deleteByThePersonsFirstname(String firstname); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepositoryLazyLoadingIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepositoryLazyLoadingIntegrationTests.java index 5bba542d8..2934f9a79 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepositoryLazyLoadingIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepositoryLazyLoadingIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 the original author or authors. + * Copyright 2010-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,10 +51,7 @@ public class PersonRepositoryLazyLoadingIntegrationTests { operations.remove(new org.springframework.data.mongodb.core.query.Query(), User.class); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void shouldLoadAssociationWithDbRefOnInterfaceAndLazyLoadingEnabled() throws Exception { User thomas = new User(); @@ -77,10 +74,7 @@ public class PersonRepositoryLazyLoadingIntegrationTests { assertThat(user.getUsername(), is(thomas.getUsername())); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void shouldLoadAssociationWithDbRefOnConcreteCollectionAndLazyLoadingEnabled() throws Exception { User thomas = new User(); @@ -108,10 +102,7 @@ public class PersonRepositoryLazyLoadingIntegrationTests { assertThat(realFan.getUsername(), is(thomas.getUsername())); } - /** - * @see DATAMONGO-348 - */ - @Test + @Test // DATAMONGO-348 public void shouldLoadAssociationWithDbRefOnConcreteDomainClassAndLazyLoadingEnabled() throws Exception { User thomas = new User(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/RedeclaringRepositoryMethodsTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/RedeclaringRepositoryMethodsTests.java index 3447d7d6a..aced3f412 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/RedeclaringRepositoryMethodsTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/RedeclaringRepositoryMethodsTests.java @@ -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. @@ -34,10 +34,7 @@ public class RedeclaringRepositoryMethodsTests extends AbstractPersonRepositoryI @Autowired RedeclaringRepositoryMethodsRepository repository; - /** - * @see DATAMONGO-760 - */ - @Test + @Test // DATAMONGO-760 public void adjustedWellKnownPagedFindAllMethodShouldReturnOnlyTheUserWithFirstnameOliverAugust() { Page page = repository.findAll(new PageRequest(0, 2)); @@ -46,10 +43,7 @@ public class RedeclaringRepositoryMethodsTests extends AbstractPersonRepositoryI assertThat(page.getContent().get(0).getFirstname(), is(oliver.getFirstname())); } - /** - * @see DATAMONGO-760 - */ - @Test + @Test // DATAMONGO-760 public void adjustedWllKnownFindAllMethodShouldReturnAnEmptyList() { List result = repository.findAll(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/CdiExtensionIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/CdiExtensionIntegrationTests.java index eef044847..b21ef5a19 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/CdiExtensionIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/CdiExtensionIntegrationTests.java @@ -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. @@ -63,10 +63,7 @@ public class CdiExtensionIntegrationTests { assertThat(repository.findOne(person.getId()).getId(), is(result.getId())); } - /** - * @see DATAMONGO-1017 - */ - @Test + @Test // DATAMONGO-1017 public void returnOneFromCustomImpl() { RepositoryClient repositoryConsumer = container.getInstance(RepositoryClient.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepository.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepository.java index 224a7ed3b..329e231fe 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepository.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepository.java @@ -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. @@ -20,6 +20,5 @@ import org.springframework.data.repository.Repository; /** * @author Mark Paluch - * @see DATAMONGO-1017 */ public interface SamplePersonRepository extends Repository, SamplePersonRepositoryCustom {} diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryCustom.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryCustom.java index a545d3591..d792f58a0 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryCustom.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryCustom.java @@ -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. @@ -17,7 +17,6 @@ package org.springframework.data.mongodb.repository.cdi; /** - * @see DATAMONGO-1017 * @author Mark Paluch */ interface SamplePersonRepositoryCustom { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryImpl.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryImpl.java index 46a22cb6e..aaa77b670 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryImpl.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/cdi/SamplePersonRepositoryImpl.java @@ -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. @@ -17,7 +17,6 @@ package org.springframework.data.mongodb.repository.cdi; /** - * @see DATAMONGO-1017 * @author Mark Paluch */ class SamplePersonRepositoryImpl implements SamplePersonRepositoryCustom { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoNamespaceIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoNamespaceIntegrationTests.java index 8847e0abd..6481c5c18 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoNamespaceIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoNamespaceIntegrationTests.java @@ -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. @@ -63,10 +63,7 @@ public class MongoNamespaceIntegrationTests extends AbstractPersonRepositoryInte assertThat(definition, is(notNullValue())); } - /** - * @see DATAMONGO-581 - */ - @Test + @Test // DATAMONGO-581 public void exposesPersistentEntity() { Repositories repositories = new Repositories(context); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoryConfigurationExtensionUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoryConfigurationExtensionUnitTests.java index eb6fd4f40..b75489b6a 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoryConfigurationExtensionUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoryConfigurationExtensionUnitTests.java @@ -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. @@ -46,30 +46,21 @@ public class MongoRepositoryConfigurationExtensionUnitTests { RepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(metadata, EnableMongoRepositories.class, loader, environment); - /** - * @see DATAMONGO-1009 - */ - @Test + @Test // DATAMONGO-1009 public void isStrictMatchIfDomainTypeIsAnnotatedWithDocument() { MongoRepositoryConfigurationExtension extension = new MongoRepositoryConfigurationExtension(); assertHasRepo(SampleRepository.class, extension.getRepositoryConfigurations(configurationSource, loader, true)); } - /** - * @see DATAMONGO-1009 - */ - @Test + @Test // DATAMONGO-1009 public void isStrictMatchIfRepositoryExtendsStoreSpecificBase() { MongoRepositoryConfigurationExtension extension = new MongoRepositoryConfigurationExtension(); assertHasRepo(StoreRepository.class, extension.getRepositoryConfigurations(configurationSource, loader, true)); } - /** - * @see DATAMONGO-1009 - */ - @Test + @Test // DATAMONGO-1009 public void isNotStrictMatchIfDomainTypeIsNotAnnotatedWithDocument() { MongoRepositoryConfigurationExtension extension = new MongoRepositoryConfigurationExtension(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/AllowNestedMongoRepositoriesRepositoryConfigTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/AllowNestedMongoRepositoriesRepositoryConfigTests.java index bb4f61d8e..315779c70 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/AllowNestedMongoRepositoriesRepositoryConfigTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/AllowNestedMongoRepositoriesRepositoryConfigTests.java @@ -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. @@ -36,10 +36,7 @@ public class AllowNestedMongoRepositoriesRepositoryConfigTests { @Autowired NestedUserRepository fooRepository; - /** - * @see DATAMONGO-780 - */ - @Test + @Test // DATAMONGO-780 public void shouldFindNestedRepository() { assertThat(fooRepository, is(notNullValue())); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/ClassWithNestedRepository.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/ClassWithNestedRepository.java index fe9b54778..9e87ef701 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/ClassWithNestedRepository.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/ClassWithNestedRepository.java @@ -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. @@ -19,7 +19,6 @@ import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.User; /** - * @see DATAMONGO-780 * @author Thomas Darimont */ public class ClassWithNestedRepository { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/NestedMongoRepositoriesJavaConfigTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/NestedMongoRepositoriesJavaConfigTests.java index e9713a383..dbea6bad2 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/NestedMongoRepositoriesJavaConfigTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/lazy/NestedMongoRepositoriesJavaConfigTests.java @@ -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. @@ -45,10 +45,7 @@ public class NestedMongoRepositoriesJavaConfigTests { @Autowired NestedUserRepository nestedUserRepository; - /** - * @see DATAMONGO-780 - */ - @Test + @Test // DATAMONGO-780 public void shouldSupportNestedRepositories() { assertThat(nestedUserRepository, is(notNullValue())); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/custom/CustomRepositoryImplementationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/custom/CustomRepositoryImplementationTests.java index d375bd0e1..951b781e0 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/custom/CustomRepositoryImplementationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/custom/CustomRepositoryImplementationTests.java @@ -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. @@ -46,10 +46,7 @@ public class CustomRepositoryImplementationTests { @Autowired CustomMongoRepository customMongoRepository; - /** - * @see DATAMONGO-804 - */ - @Test + @Test // DATAMONGO-804 public void shouldExecuteMethodOnCustomRepositoryImplementation() { String username = "bubu"; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/AbstractMongoQueryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/AbstractMongoQueryUnitTests.java index 83812b560..3b2515d78 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/AbstractMongoQueryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/AbstractMongoQueryUnitTests.java @@ -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. @@ -91,11 +91,8 @@ public class AbstractMongoQueryUnitTests { doReturn(converter).when(mongoOperationsMock).getConverter(); } - /** - * @see DATAMONGO-566 - */ @SuppressWarnings("unchecked") - @Test + @Test // DATAMONGO-566 public void testDeleteExecutionCallsRemoveCorreclty() { createQueryForMethod("deletePersonByLastname", String.class).setDeleteQuery(true).execute(new Object[] { "booh" }); @@ -105,12 +102,8 @@ public class AbstractMongoQueryUnitTests { Matchers.anyString()); } - /** - * @see DATAMONGO-566 - * @see DATAMONGO-1040 - */ @SuppressWarnings("unchecked") - @Test + @Test // DATAMONGO-566, DATAMONGO-1040 public void testDeleteExecutionLoadsListOfRemovedDocumentsWhenReturnTypeIsCollectionLike() { when(mongoOperationsMock.find(Matchers.any(Query.class), Matchers.any(Class.class), Matchers.anyString())) @@ -121,10 +114,7 @@ public class AbstractMongoQueryUnitTests { verify(mongoOperationsMock, times(1)).findAllAndRemove(Matchers.any(Query.class), eq(Person.class), eq("persons")); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void testDeleteExecutionReturnsZeroWhenWriteResultIsNull() { MongoQueryFake query = createQueryForMethod("deletePersonByLastname", String.class); @@ -133,11 +123,7 @@ public class AbstractMongoQueryUnitTests { assertThat(query.execute(new Object[] { "fake" }), Is. is(0L)); } - /** - * @see DATAMONGO-566 - * @see DATAMONGO-978 - */ - @Test + @Test // DATAMONGO-566, DATAMONGO-978 public void testDeleteExecutionReturnsNrDocumentsDeletedFromWriteResult() { when(writeResultMock.getN()).thenReturn(100); @@ -151,10 +137,7 @@ public class AbstractMongoQueryUnitTests { verify(mongoOperationsMock, times(1)).remove(Matchers.any(Query.class), eq(Person.class), eq("persons")); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void metadataShouldNotBeAddedToQueryWhenNotPresent() { MongoQueryFake query = createQueryForMethod("findByFirstname", String.class); @@ -167,10 +150,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getValue().getMeta().getComment(), nullValue()); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void metadataShouldBeAddedToQueryCorrectly() { MongoQueryFake query = createQueryForMethod("findByFirstname", String.class, Pageable.class); @@ -182,10 +162,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getValue().getMeta().getComment(), is("comment")); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void metadataShouldBeAddedToCountQueryCorrectly() { MongoQueryFake query = createQueryForMethod("findByFirstname", String.class, Pageable.class); @@ -197,10 +174,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getValue().getMeta().getComment(), is("comment")); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void metadataShouldBeAddedToStringBasedQueryCorrectly() { MongoQueryFake query = createQueryForMethod("findByAnnotatedQuery", String.class, Pageable.class); @@ -212,10 +186,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getValue().getMeta().getComment(), is("comment")); } - /** - * @see DATAMONGO-1057 - */ - @Test + @Test // DATAMONGO-1057 public void slicedExecutionShouldRetainNrOfElementsToSkip() { MongoQueryFake query = createQueryForMethod("findByLastname", String.class, Pageable.class); @@ -233,10 +204,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getAllValues().get(1).getSkip(), is(10)); } - /** - * @see DATAMONGO-1057 - */ - @Test + @Test // DATAMONGO-1057 public void slicedExecutionShouldIncrementLimitByOne() { MongoQueryFake query = createQueryForMethod("findByLastname", String.class, Pageable.class); @@ -254,10 +222,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getAllValues().get(1).getLimit(), is(11)); } - /** - * @see DATAMONGO-1057 - */ - @Test + @Test // DATAMONGO-1057 public void slicedExecutionShouldRetainSort() { MongoQueryFake query = createQueryForMethod("findByLastname", String.class, Pageable.class); @@ -276,10 +241,7 @@ public class AbstractMongoQueryUnitTests { assertThat(captor.getAllValues().get(1).getSortObject(), is(expectedSortObject)); } - /** - * @see DATAMONGO-1080 - */ - @Test + @Test // DATAMONGO-1080 public void doesNotTryToPostProcessQueryResultIntoWrapperType() { Person reference = new Person(); @@ -360,7 +322,7 @@ public class AbstractMongoQueryUnitTests { @org.springframework.data.mongodb.repository.Query("{}") Page findByAnnotatedQuery(String firstnanme, Pageable pageable); - /** @see DATAMONGO-1057 */ + // DATAMONGO-1057 Slice findByLastname(String lastname, Pageable page); Optional findByLastname(String lastname); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessorUnitTests.java index 4692b0ef2..4601c0c00 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessorUnitTests.java @@ -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. @@ -93,10 +93,7 @@ public class ConvertingParameterAccessorUnitTests { assertThat(result, is((Object) reference)); } - /** - * @see DATAMONGO-505 - */ - @Test + @Test // DATAMONGO-505 public void convertsAssociationsToDBRef() { Property property = new Property(); @@ -110,10 +107,7 @@ public class ConvertingParameterAccessorUnitTests { assertThat(dbRef.getId(), is((Object) 5L)); } - /** - * @see DATAMONGO-505 - */ - @Test + @Test // DATAMONGO-505 public void convertsAssociationsToDBRefForCollections() { Property property = new Property(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MappingMongoEntityInformationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MappingMongoEntityInformationUnitTests.java index 821aab557..5cc0a4d73 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MappingMongoEntityInformationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MappingMongoEntityInformationUnitTests.java @@ -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. @@ -45,20 +45,14 @@ public class MappingMongoEntityInformationUnitTests { when(info.getCollection()).thenReturn("Person"); } - /** - * @see DATAMONGO-248 - */ - @Test + @Test // DATAMONGO-248 public void usesEntityCollectionIfNoCustomOneGiven() { MongoEntityInformation information = new MappingMongoEntityInformation(info); assertThat(information.getCollectionName(), is("Person")); } - /** - * @see DATAMONGO-248 - */ - @Test + @Test // DATAMONGO-248 public void usesCustomCollectionIfGiven() { MongoEntityInformation information = new MappingMongoEntityInformation(info, "foobar"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersParameterAccessorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersParameterAccessorUnitTests.java index df6dd2715..bae0d460e 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersParameterAccessorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersParameterAccessorUnitTests.java @@ -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. @@ -71,10 +71,7 @@ public class MongoParametersParameterAccessorUnitTests { assertThat(accessor.getDistanceRange().getUpperBound(), is(DISTANCE)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void shouldReturnAsFullTextStringWhenNoneDefinedForMethod() throws NoSuchMethodException, SecurityException { Method method = PersonRepository.class.getMethod("findByLocationNear", Point.class, Distance.class); @@ -85,10 +82,7 @@ public class MongoParametersParameterAccessorUnitTests { assertThat(accessor.getFullText(), IsNull.nullValue()); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void shouldProperlyConvertTextCriteria() throws NoSuchMethodException, SecurityException { Method method = PersonRepository.class.getMethod("findByFirstname", String.class, TextCriteria.class); @@ -100,10 +94,7 @@ public class MongoParametersParameterAccessorUnitTests { equalTo("{ \"$text\" : { \"$search\" : \"data\"}}")); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void shouldDetectMinAndMaxDistance() throws NoSuchMethodException, SecurityException { Method method = PersonRepository.class.getMethod("findByLocationNear", Point.class, Range.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersUnitTests.java index e7468d4a1..56c63b0d3 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoParametersUnitTests.java @@ -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. @@ -100,10 +100,7 @@ public class MongoParametersUnitTests { assertThat(parameters.getNearIndex(), is(1)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void shouldFindTextCriteriaAtItsIndex() throws SecurityException, NoSuchMethodException { Method method = PersonRepository.class.getMethod("findByNameAndText", String.class, TextCriteria.class); @@ -111,10 +108,7 @@ public class MongoParametersUnitTests { assertThat(parameters.getFullTextParameterIndex(), is(1)); } - /** - * @see DATAMONGO-973 - */ - @Test + @Test // DATAMONGO-973 public void shouldTreatTextCriteriaParameterAsSpecialParameter() throws SecurityException, NoSuchMethodException { Method method = PersonRepository.class.getMethod("findByNameAndText", String.class, TextCriteria.class); @@ -122,10 +116,7 @@ public class MongoParametersUnitTests { assertThat(parameters.getParameter(parameters.getFullTextParameterIndex()).isSpecialParameter(), is(true)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void shouldFindMinAndMaxDistanceParameters() throws NoSuchMethodException, SecurityException { Method method = PersonRepository.class.getMethod("findByLocationNear", Point.class, Range.class); @@ -135,10 +126,7 @@ public class MongoParametersUnitTests { assertThat(parameters.getMaxDistanceIndex(), is(-1)); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void shouldNotHaveMinDistanceIfOnlyOneDistanceParameterPresent() throws NoSuchMethodException, SecurityException { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryCreatorUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryCreatorUnitTests.java index 71dc7316b..f6b8d8326 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryCreatorUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryCreatorUnitTests.java @@ -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. @@ -95,10 +95,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").is("Oliver")))); } - /** - * @see DATAMONGO-469 - */ - @Test + @Test // DATAMONGO-469 public void createsAndQueryCorrectly() { Person person = new Person(); @@ -169,10 +166,7 @@ public class MongoQueryCreatorUnitTests { assertThat(creator.createQuery(), is(reference)); } - /** - * @see DATAMONGO-338 - */ - @Test + @Test // DATAMONGO-338 public void createsExistsClauseCorrectly() { PartTree tree = new PartTree("findByAgeExists", Person.class); @@ -181,10 +175,7 @@ public class MongoQueryCreatorUnitTests { assertThat(creator.createQuery(), is(query)); } - /** - * @see DATAMONGO-338 - */ - @Test + @Test // DATAMONGO-338 public void createsRegexClauseCorrectly() { PartTree tree = new PartTree("findByFirstNameRegex", Person.class); @@ -193,10 +184,7 @@ public class MongoQueryCreatorUnitTests { assertThat(creator.createQuery(), is(query)); } - /** - * @see DATAMONGO-338 - */ - @Test + @Test // DATAMONGO-338 public void createsTrueClauseCorrectly() { PartTree tree = new PartTree("findByActiveTrue", Person.class); @@ -205,10 +193,7 @@ public class MongoQueryCreatorUnitTests { assertThat(creator.createQuery(), is(query)); } - /** - * @see DATAMONGO-338 - */ - @Test + @Test // DATAMONGO-338 public void createsFalseClauseCorrectly() { PartTree tree = new PartTree("findByActiveFalse", Person.class); @@ -217,10 +202,7 @@ public class MongoQueryCreatorUnitTests { assertThat(creator.createQuery(), is(query)); } - /** - * @see DATAMONGO-413 - */ - @Test + @Test // DATAMONGO-413 public void createsOrQueryCorrectly() { PartTree tree = new PartTree("findByFirstNameOrAge", Person.class); @@ -230,10 +212,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(new Criteria().orOperator(where("firstName").is("Dave"), where("age").is(42))))); } - /** - * @see DATAMONGO-347 - */ - @Test + @Test // DATAMONGO-347 public void createsQueryReferencingADBRefCorrectly() { User user = new User(); @@ -246,10 +225,7 @@ public class MongoQueryCreatorUnitTests { assertThat(queryObject.get("creator"), is((Object) user)); } - /** - * @see DATAMONGO-418 - */ - @Test + @Test // DATAMONGO-418 public void createsQueryWithStartingWithPredicateCorrectly() { PartTree tree = new PartTree("findByUsernameStartingWith", User.class); @@ -259,10 +235,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex("^Matt")))); } - /** - * @see DATAMONGO-418 - */ - @Test + @Test // DATAMONGO-418 public void createsQueryWithEndingWithPredicateCorrectly() { PartTree tree = new PartTree("findByUsernameEndingWith", User.class); @@ -272,10 +245,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex("ews$")))); } - /** - * @see DATAMONGO-418 - */ - @Test + @Test // DATAMONGO-418 public void createsQueryWithContainingPredicateCorrectly() { PartTree tree = new PartTree("findByUsernameContaining", User.class); @@ -301,10 +271,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query)); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void createsQueryWithFindByIgnoreCaseCorrectly() { PartTree tree = new PartTree("findByfirstNameIgnoreCase", Person.class); @@ -314,10 +281,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").regex("^dave$", "i")))); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void createsQueryWithFindByNotIgnoreCaseCorrectly() { PartTree tree = new PartTree("findByFirstNameNotIgnoreCase", Person.class); @@ -327,10 +291,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query.toString(), is(query(where("firstName").not().regex("^dave$", "i")).toString())); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void createsQueryWithFindByStartingWithIgnoreCaseCorrectly() { PartTree tree = new PartTree("findByFirstNameStartingWithIgnoreCase", Person.class); @@ -340,10 +301,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").regex("^dave", "i")))); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void createsQueryWithFindByEndingWithIgnoreCaseCorrectly() { PartTree tree = new PartTree("findByFirstNameEndingWithIgnoreCase", Person.class); @@ -353,10 +311,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").regex("dave$", "i")))); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void createsQueryWithFindByContainingIgnoreCaseCorrectly() { PartTree tree = new PartTree("findByFirstNameContainingIgnoreCase", Person.class); @@ -366,10 +321,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").regex(".*dave.*", "i")))); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void shouldThrowExceptionForQueryWithFindByIgnoreCaseOnNonStringProperty() { expection.expect(IllegalArgumentException.class); @@ -381,10 +333,7 @@ public class MongoQueryCreatorUnitTests { creator.createQuery(); } - /** - * @see DATAMONGO-770 - */ - @Test + @Test // DATAMONGO-770 public void shouldOnlyGenerateLikeExpressionsForStringPropertiesIfAllIgnoreCase() { PartTree tree = new PartTree("findByFirstNameAndAgeAllIgnoreCase", Person.class); @@ -394,10 +343,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").regex("^dave$", "i").and("age").is(42)))); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void shouldCreateDeleteByQueryCorrectly() { PartTree tree = new PartTree("deleteByFirstName", Person.class); @@ -409,10 +355,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").is("dave")))); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void shouldCreateDeleteByQueryCorrectlyForMultipleCriteriaAndCaseExpressions() { PartTree tree = new PartTree("deleteByFirstNameAndAgeAllIgnoreCase", Person.class); @@ -424,10 +367,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("firstName").regex("^dave$", "i").and("age").is(42)))); } - /** - * @see DATAMONGO-1075 - */ - @Test + @Test // DATAMONGO-1075 public void shouldCreateInClauseWhenUsingContainsOnCollectionLikeProperty() { PartTree tree = new PartTree("findByEmailAddressesContaining", User.class); @@ -438,10 +378,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("emailAddresses").in("dave")))); } - /** - * @see DATAMONGO-1075 - */ - @Test + @Test // DATAMONGO-1075 public void shouldCreateInClauseWhenUsingNotContainsOnCollectionLikeProperty() { PartTree tree = new PartTree("findByEmailAddressesNotContaining", User.class); @@ -452,11 +389,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("emailAddresses").not().in("dave")))); } - /** - * @see DATAMONGO-1075 - * @see DATAMONGO-1425 - */ - @Test + @Test // DATAMONGO-1075, DATAMONGO-1425 public void shouldCreateRegexWhenUsingNotContainsOnStringProperty() { PartTree tree = new PartTree("findByUsernameNotContaining", User.class); @@ -466,10 +399,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query.getQueryObject(), is(query(where("username").not().regex(".*thew.*")).getQueryObject())); } - /** - * @see DATAMONGO-1139 - */ - @Test + @Test // DATAMONGO-1139 public void createsNonShericalNearForDistanceWithDefaultMetric() { Point point = new Point(1.0, 1.0); @@ -482,10 +412,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("location").near(point).maxDistance(1.0)))); } - /** - * @see DATAMONGO-1136 - */ - @Test + @Test // DATAMONGO-1136 public void shouldCreateWithinQueryCorrectly() { Point first = new Point(1, 1); @@ -500,10 +427,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("address.geo").within(shape)))); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void shouldCreateNearSphereQueryForSphericalProperty() { Point point = new Point(10, 20); @@ -515,10 +439,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("address2dSphere.geo").nearSphere(point)))); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void shouldCreateNearSphereQueryForSphericalPropertyHavingDistanceWithDefaultMetric() { Point point = new Point(1.0, 1.0); @@ -531,10 +452,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("address2dSphere.geo").nearSphere(point).maxDistance(1.0)))); } - /** - * @see DATAMONGO-1110 - */ - @Test + @Test // DATAMONGO-1110 public void shouldCreateNearQueryForMinMaxDistance() { Point point = new Point(10, 20); @@ -547,10 +465,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("address.geo").near(point).minDistance(10D).maxDistance(20D)))); } - /** - * @see DATAMONGO-1229 - */ - @Test + @Test // DATAMONGO-1229 public void appliesIgnoreCaseToLeafProperty() { PartTree tree = new PartTree("findByAddressStreetIgnoreCase", User.class); @@ -559,10 +474,7 @@ public class MongoQueryCreatorUnitTests { assertThat(new MongoQueryCreator(tree, accessor, context).createQuery(), is(notNullValue())); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void ignoreCaseShouldEscapeSource() { PartTree tree = new PartTree("findByUsernameIgnoreCase", User.class); @@ -573,10 +485,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex("^\\Qcon.flux+\\E$", "i")))); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void ignoreCaseShouldEscapeSourceWhenUsedForStartingWith() { PartTree tree = new PartTree("findByUsernameStartingWithIgnoreCase", User.class); @@ -587,10 +496,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex("^\\Qdawns.light+\\E", "i")))); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void ignoreCaseShouldEscapeSourceWhenUsedForEndingWith() { PartTree tree = new PartTree("findByUsernameEndingWithIgnoreCase", User.class); @@ -601,10 +507,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex("\\Qnew.ton+\\E$", "i")))); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void likeShouldEscapeSourceWhenUsedWithLeadingAndTrailingWildcard() { PartTree tree = new PartTree("findByUsernameLike", User.class); @@ -615,10 +518,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex(".*\\Qfire.fight+\\E.*")))); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void likeShouldEscapeSourceWhenUsedWithLeadingWildcard() { PartTree tree = new PartTree("findByUsernameLike", User.class); @@ -629,10 +529,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex(".*\\Qsteel.heart+\\E")))); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void likeShouldEscapeSourceWhenUsedWithTrailingWildcard() { PartTree tree = new PartTree("findByUsernameLike", User.class); @@ -642,10 +539,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex("\\Qcala.mity+\\E.*")))); } - /** - * @see DATAMONGO-1232 - */ - @Test + @Test // DATAMONGO-1232 public void likeShouldBeTreatedCorrectlyWhenUsedWithWildcardOnly() { PartTree tree = new PartTree("findByUsernameLike", User.class); @@ -655,10 +549,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("username").regex(".*")))); } - /** - * @see DATAMONGO-1342 - */ - @Test + @Test // DATAMONGO-1342 public void bindsNullValueToContainsClause() { PartTree partTree = new PartTree("emailAddressesContains", User.class); @@ -669,10 +560,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query, is(query(where("emailAddresses").in((Object) null)))); } - /** - * @see DATAMONGO-1424 - */ - @Test + @Test // DATAMONGO-1424 public void notLikeShouldEscapeSourceWhenUsedWithLeadingAndTrailingWildcard() { PartTree tree = new PartTree("findByUsernameNotLike", User.class); @@ -684,10 +572,7 @@ public class MongoQueryCreatorUnitTests { is(query(where("username").not().regex(".*\\Qfire.fight+\\E.*")).getQueryObject())); } - /** - * @see DATAMONGO-1424 - */ - @Test + @Test // DATAMONGO-1424 public void notLikeShouldEscapeSourceWhenUsedWithLeadingWildcard() { PartTree tree = new PartTree("findByUsernameNotLike", User.class); @@ -699,10 +584,7 @@ public class MongoQueryCreatorUnitTests { is(query(where("username").not().regex(".*\\Qsteel.heart+\\E")).getQueryObject())); } - /** - * @see DATAMONGO-1424 - */ - @Test + @Test // DATAMONGO-1424 public void notLikeShouldEscapeSourceWhenUsedWithTrailingWildcard() { PartTree tree = new PartTree("findByUsernameNotLike", User.class); @@ -712,10 +594,7 @@ public class MongoQueryCreatorUnitTests { assertThat(query.getQueryObject(), is(query(where("username").not().regex("\\Qcala.mity+\\E.*")).getQueryObject())); } - /** - * @see DATAMONGO-1424 - */ - @Test + @Test // DATAMONGO-1424 public void notLikeShouldBeTreatedCorrectlyWhenUsedWithWildcardOnly() { PartTree tree = new PartTree("findByUsernameNotLike", User.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryExecutionUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryExecutionUnitTests.java index 133e910dd..7ccac637b 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryExecutionUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryExecutionUnitTests.java @@ -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. @@ -82,10 +82,7 @@ public class MongoQueryExecutionUnitTests { when(mongoOperationsMock.getConverter()).thenReturn(converter); } - /** - * @see DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1464 public void pagedExecutionShouldNotGenerateCountQueryIfQueryReportedNoResults() { when(mongoOperationsMock.find(any(Query.class), eq(Person.class), eq("person"))) @@ -98,10 +95,7 @@ public class MongoQueryExecutionUnitTests { verify(mongoOperationsMock, never()).count(any(Query.class), eq(Person.class), eq("person")); } - /** - * @see DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1464 public void pagedExecutionShouldUseCountFromResultWithOffsetAndResultsWithinPageSize() { when(mongoOperationsMock.find(any(Query.class), eq(Person.class), eq("person"))) @@ -114,10 +108,7 @@ public class MongoQueryExecutionUnitTests { verify(mongoOperationsMock, never()).count(any(Query.class), eq(Person.class), eq("person")); } - /** - * @see DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1464 public void pagedExecutionRetrievesObjectsForPageableOutOfRange() throws Exception { when(mongoOperationsMock.find(any(Query.class), eq(Person.class), eq("person"))) @@ -130,10 +121,7 @@ public class MongoQueryExecutionUnitTests { verify(mongoOperationsMock).count(any(Query.class), eq(Person.class), eq("person")); } - /** - * @see DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1464 public void pagingGeoExecutionShouldUseCountFromResultWithOffsetAndResultsWithinPageSize() throws Exception { MongoParameterAccessor accessor = new MongoParametersParameterAccessor(queryMethod, @@ -153,10 +141,7 @@ public class MongoQueryExecutionUnitTests { verify(mongoOperationsMock, never()).count(any(Query.class), eq("person")); } - /** - * @see DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1464 public void pagingGeoExecutionRetrievesObjectsForPageableOutOfRange() throws Exception { MongoParameterAccessor accessor = new MongoParametersParameterAccessor(queryMethod, diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java index bba8388d0..0955a3078 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java @@ -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. @@ -128,10 +128,7 @@ public class MongoQueryMethodUnitTests { queryMethod(SampleRepository2.class, "methodReturningAnInterface"); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void createsMongoQueryMethodWithEmptyMetaCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "emptyMetaAnnotation"); @@ -140,10 +137,7 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().hasValues(), is(false)); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void createsMongoQueryMethodWithMaxExecutionTimeCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithMaxExecutionTime"); @@ -152,10 +146,7 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().getMaxTimeMsec(), is(100L)); } - /** - * @see DATAMONGO-1403 - */ - @Test + @Test // DATAMONGO-1403 public void createsMongoQueryMethodWithSpellFixedMaxExecutionTimeCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithSpellFixedMaxExecutionTime"); @@ -164,10 +155,7 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().getMaxTimeMsec(), is(100L)); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void createsMongoQueryMethodWithMaxScanCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithMaxScan"); @@ -176,10 +164,7 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().getMaxScan(), is(10L)); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void createsMongoQueryMethodWithCommentCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithComment"); @@ -188,10 +173,7 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().getComment(), is("foo bar")); } - /** - * @see DATAMONGO-957 - */ - @Test + @Test // DATAMONGO-957 public void createsMongoQueryMethodWithSnapshotCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithSnapshotUsage"); @@ -200,10 +182,7 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().getSnapshot(), is(true)); } - /** - * @see DATAMONGO-1480 - */ - @Test + @Test // DATAMONGO-1480 public void createsMongoQueryMethodWithNoCursorTimeoutCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithNoCursorTimeout"); @@ -213,10 +192,7 @@ public class MongoQueryMethodUnitTests { containsInAnyOrder(org.springframework.data.mongodb.core.query.Meta.CursorOption.NO_TIMEOUT)); } - /** - * @see DATAMONGO-1480 - */ - @Test + @Test // DATAMONGO-1480 public void createsMongoQueryMethodWithMultipleFlagsCorrectly() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithMultipleFlags"); @@ -226,10 +202,7 @@ public class MongoQueryMethodUnitTests { containsInAnyOrder(org.springframework.data.mongodb.core.query.Meta.CursorOption.NO_TIMEOUT, org.springframework.data.mongodb.core.query.Meta.CursorOption.SLAVE_OK)); } - /** - * @see DATAMONGO-1266 - */ - @Test + @Test // DATAMONGO-1266 public void fallsBackToRepositoryDomainTypeIfMethodDoesNotReturnADomainType() throws Exception { MongoQueryMethod method = queryMethod(PersonRepository.class, "deleteByUserName", String.class); @@ -281,9 +254,7 @@ public class MongoQueryMethodUnitTests { @Meta(flags = { org.springframework.data.mongodb.core.query.Meta.CursorOption.NO_TIMEOUT, org.springframework.data.mongodb.core.query.Meta.CursorOption.SLAVE_OK }) List metaWithMultipleFlags(); - /** - * @see DATAMONGO-1266 - */ + // DATAMONGO-1266 void deleteByUserName(String userName); } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/PartTreeMongoQueryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/PartTreeMongoQueryUnitTests.java index 9e578c9df..45912de68 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/PartTreeMongoQueryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/PartTreeMongoQueryUnitTests.java @@ -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. @@ -77,10 +77,7 @@ public class PartTreeMongoQueryUnitTests { when(mongoOperationsMock.getConverter()).thenReturn(converter); } - /** - * @see DATAMOGO-952 - */ - @Test + @Test // DATAMOGO-952 public void rejectsInvalidFieldSpecification() { exception.expect(IllegalStateException.class); @@ -89,10 +86,7 @@ public class PartTreeMongoQueryUnitTests { deriveQueryFromMethod("findByLastname", new Object[] { "foo" }); } - /** - * @see DATAMOGO-952 - */ - @Test + @Test // DATAMOGO-952 public void singleFieldJsonIncludeRestrictionShouldBeConsidered() { org.springframework.data.mongodb.core.query.Query query = deriveQueryFromMethod("findByFirstname", @@ -101,10 +95,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(query.getFieldsObject(), is(new BasicDBObjectBuilder().add("firstname", 1).get())); } - /** - * @see DATAMOGO-952 - */ - @Test + @Test // DATAMOGO-952 public void multiFieldJsonIncludeRestrictionShouldBeConsidered() { org.springframework.data.mongodb.core.query.Query query = deriveQueryFromMethod("findByFirstnameAndLastname", @@ -113,10 +104,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(query.getFieldsObject(), is(new BasicDBObjectBuilder().add("firstname", 1).add("lastname", 1).get())); } - /** - * @see DATAMOGO-952 - */ - @Test + @Test // DATAMOGO-952 public void multiFieldJsonExcludeRestrictionShouldBeConsidered() { org.springframework.data.mongodb.core.query.Query query = deriveQueryFromMethod("findPersonByFirstnameAndLastname", @@ -125,10 +113,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(query.getFieldsObject(), is(new BasicDBObjectBuilder().add("firstname", 0).add("lastname", 0).get())); } - /** - * @see DATAMOGO-973 - */ - @Test + @Test // DATAMOGO-973 public void shouldAddFullTextParamCorrectlyToDerivedQuery() { org.springframework.data.mongodb.core.query.Query query = deriveQueryFromMethod("findPersonByFirstname", @@ -137,10 +122,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(query, isTextQuery().searchingFor("search").where(new Criteria("firstname").is("text"))); } - /** - * @see DATAMONGO-1180 - */ - @Test + @Test // DATAMONGO-1180 public void propagatesRootExceptionForInvalidQuery() { exception.expect(IllegalStateException.class); @@ -149,18 +131,12 @@ public class PartTreeMongoQueryUnitTests { deriveQueryFromMethod("findByAge", new Object[] { 1 }); } - /** - * @see DATAMONGO-1345 - */ - @Test + @Test // DATAMONGO-1345 public void doesNotDeriveFieldSpecForNormalDomainType() { assertThat(deriveQueryFromMethod("findPersonBy", new Object[0]).getFieldsObject(), is(nullValue())); } - /** - * @see DATAMONGO-1345 - */ - @Test + @Test // DATAMONGO-1345 public void restrictsQueryToFieldsRequiredForProjection() { DBObject fieldsObject = deriveQueryFromMethod("findPersonProjectedBy", new Object[0]).getFieldsObject(); @@ -169,10 +145,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(fieldsObject.get("lastname"), is((Object) 1)); } - /** - * @see DATAMONGO-1345 - */ - @Test + @Test // DATAMONGO-1345 public void restrictsQueryToFieldsRequiredForDto() { DBObject fieldsObject = deriveQueryFromMethod("findPersonDtoByAge", new Object[] { 42 }).getFieldsObject(); @@ -181,10 +154,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(fieldsObject.get("lastname"), is((Object) 1)); } - /** - * @see DATAMONGO-1345 - */ - @Test + @Test // DATAMONGO-1345 public void usesDynamicProjection() { DBObject fields = deriveQueryFromMethod("findDynamicallyProjectedBy", ExtendedProjection.class).getFieldsObject(); @@ -194,10 +164,7 @@ public class PartTreeMongoQueryUnitTests { assertThat(fields.get("age"), is((Object) 1)); } - /** - * @see DATAMONGO-1500 - */ - @Test + @Test // DATAMONGO-1500 public void shouldLeaveParameterConversionToQueryMapper() { org.springframework.data.mongodb.core.query.Query query = deriveQueryFromMethod("findBySex", Sex.FEMALE); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/StringBasedMongoQueryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/StringBasedMongoQueryUnitTests.java index b66056125..f5b6ba6d6 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/StringBasedMongoQueryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/StringBasedMongoQueryUnitTests.java @@ -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. @@ -144,10 +144,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject().get("address"), is(nullValue())); } - /** - * @see DATAMONGO-821 - */ - @Test + @Test // DATAMONGO-821 public void bindsDbrefCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByHavingSizeFansNotZero"); @@ -157,28 +154,19 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(new BasicQuery("{ fans : { $not : { $size : 0 } } }").getQueryObject())); } - /** - * @see DATAMONGO-566 - */ - @Test + @Test // DATAMONGO-566 public void constructsDeleteQueryCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("removeByLastname", String.class); assertThat(mongoQuery.isDeleteQuery(), is(true)); } - /** - * @see DATAMONGO-566 - */ - @Test(expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) // DATAMONGO-566 public void preventsDeleteAndCountFlagAtTheSameTime() throws Exception { createQueryForMethod("invalidMethod", String.class); } - /** - * @see DATAMONGO-420 - */ - @Test + @Test // DATAMONGO-420 public void shouldSupportFindByParameterizedCriteriaAndFields() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, @@ -193,10 +181,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getFieldsObject(), is(new BasicQuery(null, "{ \"lastname\": 1}").getFieldsObject())); } - /** - * @see DATAMONGO-420 - */ - @Test + @Test // DATAMONGO-420 public void shouldSupportRespectExistingQuotingInFindByTitleBeginsWithExplicitQuoting() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "fun"); @@ -207,10 +192,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(new BasicQuery("{title: {$regex: '^fun', $options: 'i'}}").getQueryObject())); } - /** - * @see DATAMONGO-995, DATAMONGO-420 - */ - @Test + @Test // DATAMONGO-995, DATAMONGO-420 public void shouldParseQueryWithParametersInExpression() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, 1, 2, 3, 4); @@ -224,10 +206,7 @@ public class StringBasedMongoQueryUnitTests { .getQueryObject())); } - /** - * @see DATAMONGO-995, DATAMONGO-420 - */ - @Test + @Test // DATAMONGO-995, DATAMONGO-420 public void bindsSimplePropertyAlreadyQuotedCorrectly() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "Matthews"); @@ -239,10 +218,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-995, DATAMONGO-420 - */ - @Test + @Test // DATAMONGO-995, DATAMONGO-420 public void bindsSimplePropertyAlreadyQuotedWithRegexCorrectly() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "^Mat.*"); @@ -254,10 +230,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-995, DATAMONGO-420 - */ - @Test + @Test // DATAMONGO-995, DATAMONGO-420 public void bindsSimplePropertyWithRegexCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastname", String.class); @@ -269,10 +242,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-1070 - */ - @Test + @Test // DATAMONGO-1070 public void parsesDbRefDeclarationsCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("methodWithManuallyDefinedDbRef", String.class); @@ -285,10 +255,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(dbRef.getCollectionName(), is("reference")); } - /** - * @see DATAMONGO-1072 - */ - @Test + @Test // DATAMONGO-1072 public void shouldParseJsonKeyReplacementCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("methodWithPlaceholderInKeyOfJsonStructure", String.class, @@ -300,10 +267,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(new BasicDBObjectBuilder().add("key", "value").get())); } - /** - * @see DATAMONGO-990 - */ - @Test + @Test // DATAMONGO-990 public void shouldSupportExpressionsInCustomQueries() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "Matthews"); @@ -315,10 +279,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-1244 - */ - @Test + @Test // DATAMONGO-1244 public void shouldSupportExpressionsInCustomQueriesWithNestedObject() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, true, "param1", "param2"); @@ -331,10 +292,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-1244 - */ - @Test + @Test // DATAMONGO-1244 public void shouldSupportExpressionsInCustomQueriesWithMultipleNestedObjects() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, true, "param1", "param2"); @@ -348,10 +306,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-1290 - */ - @Test + @Test // DATAMONGO-1290 public void shouldSupportNonQuotedBinaryDataReplacement() throws Exception { byte[] binaryData = "Matthews".getBytes("UTF-8"); @@ -365,10 +320,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-1454 - */ - @Test + @Test // DATAMONGO-1454 public void shouldSupportExistsProjection() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("existsByLastname", String.class); @@ -376,10 +328,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(mongoQuery.isExistsQuery(), is(true)); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void bindsPropertyReferenceMultipleTimesCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByAgeQuotedAndUnquoted", Integer.TYPE); @@ -396,10 +345,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is(reference.getQueryObject())); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void shouldIgnorePlaceholderPatternInReplacementValue() throws Exception { ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "argWith?1andText", @@ -412,10 +358,7 @@ public class StringBasedMongoQueryUnitTests { is(JSON.parse("{ \"arg0\" : \"argWith?1andText\" , \"arg1\" : \"nothing-special\"}"))); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void shouldQuoteStringReplacementCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameQuoted", String.class); @@ -427,10 +370,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is((DBObject) new BasicDBObject("lastname", "Matthews', password: 'foo"))); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void shouldQuoteStringReplacementContainingQuotesCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameQuoted", String.class); @@ -442,10 +382,7 @@ public class StringBasedMongoQueryUnitTests { assertThat(query.getQueryObject(), is((DBObject) new BasicDBObject("lastname", "Matthews\", password: \"foo"))); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void shouldQuoteStringReplacementWithQuotationsCorrectly() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameQuoted", String.class); @@ -457,10 +394,7 @@ public class StringBasedMongoQueryUnitTests { is((DBObject) new BasicDBObject("lastname", "\"Dave Matthews\", password: 'foo"))); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void shouldQuoteComplexQueryStringCorreclty() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameQuoted", String.class); @@ -471,10 +405,7 @@ public class StringBasedMongoQueryUnitTests { is((DBObject) new BasicDBObject("lastname", new BasicDBObject("$ne", "calamity")))); } - /** - * @see DATAMONGO-1565 - */ - @Test + @Test // DATAMONGO-1565 public void shouldQuotationInQuotedComplexQueryString() throws Exception { StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameQuoted", String.class); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/MongoRepositoryFactoryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/MongoRepositoryFactoryUnitTests.java index be030e07a..68282293b 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/MongoRepositoryFactoryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/MongoRepositoryFactoryUnitTests.java @@ -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. @@ -75,10 +75,7 @@ public class MongoRepositoryFactoryUnitTests { assertTrue(entityInformation instanceof MappingMongoEntityInformation); } - /** - * @see DATAMONGO-385 - */ - @Test + @Test // DATAMONGO-385 @SuppressWarnings("unchecked") public void createsRepositoryWithIdTypeLong() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QueryDslMongoRepositoryIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QueryDslMongoRepositoryIntegrationTests.java index 419683ccc..de30bf44d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QueryDslMongoRepositoryIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QueryDslMongoRepositoryIntegrationTests.java @@ -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. @@ -70,10 +70,7 @@ public class QueryDslMongoRepositoryIntegrationTests { repository.save(Arrays.asList(oliver, dave, carter)); } - /** - * @see DATAMONGO-1146 - */ - @Test + @Test // DATAMONGO-1146 public void shouldSupportExistsWithPredicate() throws Exception { assertThat(repository.exists(person.firstname.eq("Dave")), is(true)); @@ -81,10 +78,7 @@ public class QueryDslMongoRepositoryIntegrationTests { assertThat(repository.exists((Predicate) null), is(true)); } - /** - * @see DATAMONGO-1167 - */ - @Test + @Test // DATAMONGO-1167 public void shouldSupportFindAllWithPredicateAndSort() { List users = repository.findAll(person.lastname.isNotNull(), new Sort(Direction.ASC, "firstname")); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QuerydslRepositorySupportTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QuerydslRepositorySupportTests.java index 814a1be19..e4b6ba694 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QuerydslRepositorySupportTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/QuerydslRepositorySupportTests.java @@ -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. @@ -65,10 +65,7 @@ public class QuerydslRepositorySupportTests { assertThat(query.fetchOne(), is(person)); } - /** - * @see DATAMONGO-1063 - */ - @Test + @Test // DATAMONGO-1063 public void shouldAllowAny() { person.setSkills(Arrays.asList("vocalist", "songwriter", "guitarist")); @@ -82,10 +79,7 @@ public class QuerydslRepositorySupportTests { assertThat(query.fetchOne(), is(person)); } - /** - * @see DATAMONGO-1394 - */ - @Test + @Test // DATAMONGO-1394 public void shouldAllowDbRefAgainstIdProperty() { User bart = new User(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepositoryTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepositoryTests.java index 81f3661f7..10aaa8564 100755 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepositoryTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 the original author or authors. + * Copyright 2010-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. @@ -113,10 +113,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, not(hasItem(dave))); } - /** - * @see DATAMONGO-1054 - */ - @Test + @Test // DATAMONGO-1054 public void shouldInsertSingle() { String randomId = UUID.randomUUID().toString(); @@ -129,10 +126,7 @@ public class SimpleMongoRepositoryTests { assertThat(saved, is(equalTo(person1))); } - /** - * @see DATAMONGO-1054 - */ - @Test + @Test // DATAMONGO-1054 public void shouldInsertMultipleFromList() { String randomId = UUID.randomUUID().toString(); @@ -151,10 +145,7 @@ public class SimpleMongoRepositoryTests { assertThatAllReferencePersonsWereStoredCorrectly(idToPerson, saved); } - /** - * @see DATAMONGO-1054 - */ - @Test + @Test // DATAMONGO-1054 public void shouldInsertMutlipleFromSet() { String randomId = UUID.randomUUID().toString(); @@ -173,10 +164,7 @@ public class SimpleMongoRepositoryTests { assertThatAllReferencePersonsWereStoredCorrectly(idToPerson, saved); } - /** - * @see DATAMONGO-1245, DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1245, DATAMONGO-1464 public void findByExampleShouldLookUpEntriesCorrectly() { Person sample = new Person(); @@ -190,10 +178,7 @@ public class SimpleMongoRepositoryTests { assertThat(result.getTotalPages(), is(1)); } - /** - * @see DATAMONGO-1464 - */ - @Test + @Test // DATAMONGO-1464 public void findByExampleMultiplePagesShouldLookUpEntriesCorrectly() { Person sample = new Person(); @@ -206,10 +191,7 @@ public class SimpleMongoRepositoryTests { assertThat(result.getTotalPages(), is(2)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldLookUpEntriesCorrectly() { Person sample = new Person(); @@ -222,10 +204,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(2)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldLookUpEntriesCorrectlyWhenUsingNestedObject() { dave.setAddress(new Address("1600 Pennsylvania Ave NW", "20500", "Washington")); @@ -244,10 +223,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldLookUpEntriesCorrectlyWhenUsingPartialNestedObject() { dave.setAddress(new Address("1600 Pennsylvania Ave NW", "20500", "Washington")); @@ -266,10 +242,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(2)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldNotFindEntriesWhenUsingPartialNestedObjectInStrictMode() { dave.setAddress(new Address("1600 Pennsylvania Ave NW", "20500", "Washington")); @@ -285,10 +258,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, empty()); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldLookUpEntriesCorrectlyWhenUsingNestedObjectInStrictMode() { dave.setAddress(new Address("1600 Pennsylvania Ave NW", "20500", "Washington")); @@ -305,10 +275,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldRespectStringMatchMode() { Person sample = new Person(); @@ -322,10 +289,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(2)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldResolveDbRefCorrectly() { User user = new User(); @@ -348,10 +312,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldResolveLegacyCoordinatesCorrectly() { Person megan = new Person("megan", "tarash"); @@ -369,10 +330,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldResolveGeoJsonCoordinatesCorrectly() { Person megan = new Person("megan", "tarash"); @@ -390,10 +348,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasSize(1)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findAllByExampleShouldProcessInheritanceCorrectly() { PersonExtended reference = new PersonExtended(); @@ -412,10 +367,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, hasItem(reference)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void findOneByExampleShouldLookUpEntriesCorrectly() { Person sample = new Person(); @@ -428,10 +380,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, is(equalTo(dave))); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void existsByExampleShouldLookUpEntriesCorrectly() { Person sample = new Person(); @@ -444,10 +393,7 @@ public class SimpleMongoRepositoryTests { assertThat(result, is(true)); } - /** - * @see DATAMONGO-1245 - */ - @Test + @Test // DATAMONGO-1245 public void countByExampleShouldLookUpEntriesCorrectly() { Person sample = new Person(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SpringDataMongodbSerializerUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SpringDataMongodbSerializerUnitTests.java index 986a29b4b..bf20640b5 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SpringDataMongodbSerializerUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SpringDataMongodbSerializerUnitTests.java @@ -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. @@ -103,20 +103,14 @@ public class SpringDataMongodbSerializerUnitTests { assertThat(value, is(reference)); } - /** - * @see DATAMONGO-376 - */ - @Test + @Test // DATAMONGO-376 public void returnsEmptyStringIfNoPathExpressionIsGiven() { QAddress address = QPerson.person.shippingAddresses.any(); assertThat(serializer.getKeyForPath(address, address.getMetadata()), is("")); } - /** - * @see DATAMONGO-467 - */ - @Test + @Test // DATAMONGO-467 public void convertsIdPropertyCorrectly() { ObjectId id = new ObjectId(); @@ -130,10 +124,7 @@ public class SpringDataMongodbSerializerUnitTests { assertThat(result.get("_id"), is((Object) id)); } - /** - * @see DATAMONGO-761 - */ - @Test + @Test // DATAMONGO-761 public void looksUpKeyForNonPropertyPath() { PathBuilder
builder = new PathBuilder
(Address.class, "address"); @@ -143,10 +134,7 @@ public class SpringDataMongodbSerializerUnitTests { assertThat(path, is("0")); } - /** - * @see DATAMONGO-969 - */ - @Test + @Test // DATAMONGO-969 public void shouldConvertObjectIdEvenWhenNestedInOperatorDbObject() { ObjectId value = new ObjectId("53bb9fd14438765b29c2d56e"); @@ -157,10 +145,7 @@ public class SpringDataMongodbSerializerUnitTests { assertThat($ne, is(value)); } - /** - * @see DATAMONGO-969 - */ - @Test + @Test // DATAMONGO-969 public void shouldConvertCollectionOfObjectIdEvenWhenNestedInOperatorDbObject() { ObjectId firstId = new ObjectId("53bb9fd14438765b29c2d56e"); @@ -178,10 +163,7 @@ public class SpringDataMongodbSerializerUnitTests { assertThat($in, Matchers. arrayContaining(firstId, secondId)); } - /** - * @see DATAMONGO-1485 - */ - @Test + @Test // DATAMONGO-1485 public void takesCustomConversionForEnumsIntoAccount() { MongoMappingContext context = new MongoMappingContext();