DATAMONGO-1587 - Migrate ticket references in test code to Spring Framework style.

This commit is contained in:
Mark Paluch
2017-01-12 16:17:38 +01:00
parent 8df9d30d2e
commit 644c1a2c89
170 changed files with 2071 additions and 7474 deletions

View File

@@ -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();
}

View File

@@ -339,7 +339,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();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import com.mongodb.MongoClient;
/**
* Sample configuration class in default package.
*
* @see DATAMONGO-877
* @author Oliver Gierke
*/
@Configuration

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,10 +57,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();
@@ -69,28 +66,19 @@ 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 {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,10 +42,7 @@ public class AbstractReactiveMongoConfigurationIntegrationTests {
@Autowired ApplicationContext context;
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void contextShouldContainTemplate() {
assertThat(context.getBean(SimpleReactiveMongoDatabaseFactory.class)).isNotNull();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,10 +57,7 @@ public class AbstractReactiveMongoConfigurationUnitTests {
@Rule public ExpectedException exception = ExpectedException.none();
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void usesConfigClassPackageAsBaseMappingPackage() throws ClassNotFoundException {
AbstractReactiveMongoConfiguration configuration = new SampleMongoConfiguration();
@@ -69,28 +66,19 @@ public class AbstractReactiveMongoConfigurationUnitTests {
assertThat(configuration.getInitialEntitySet(), hasItem(Entity.class));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void doesNotScanPackageIfMappingPackageIsNull() throws ClassNotFoundException {
assertScanningDisabled(null);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void doesNotScanPackageIfMappingPackageIsEmpty() throws ClassNotFoundException {
assertScanningDisabled("");
assertScanningDisabled(" ");
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void containsMongoDbFactoryButNoMongoBean() {
AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class);
@@ -102,10 +90,7 @@ public class AbstractReactiveMongoConfigurationUnitTests {
context.close();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void returnsUninitializedMappingContext() throws Exception {
SampleMongoConfiguration configuration = new SampleMongoConfiguration();
@@ -116,10 +101,7 @@ public class AbstractReactiveMongoConfigurationUnitTests {
assertThat(context.getPersistentEntities(), is(not(emptyIterable())));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void lifecycleCallbacksAreInvokedInAppropriateOrder() {
AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class);
@@ -131,10 +113,7 @@ public class AbstractReactiveMongoConfigurationUnitTests {
context.close();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void shouldBeAbleToConfigureCustomTypeMapperViaJavaConfig() {
AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class);
@@ -146,10 +125,7 @@ public class AbstractReactiveMongoConfigurationUnitTests {
context.close();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
@SuppressWarnings("unchecked")
public void allowsMultipleEntityBasePackages() throws ClassNotFoundException {

View File

@@ -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());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,10 +43,7 @@ public class GeoJsonConfigurationIntegrationTests {
@Autowired GeoJsonModule geoJsonModule;
/**
* @see DATAMONGO-1181
*/
@Test
@Test // DATAMONGO-1181
public void picksUpGeoJsonModuleConfigurationByDefault() {
assertThat(geoJsonModule, is(notNullValue()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,10 +57,7 @@ public class MappingMongoConverterParserIntegrationTests {
DefaultListableBeanFactory factory;
/**
* @see DATAMONGO-243
*/
@Test
@Test // DATAMONGO-243
public void allowsDbFactoryRefAttribute() {
loadValidConfiguration();
@@ -68,10 +65,7 @@ public class MappingMongoConverterParserIntegrationTests {
factory.getBean("converter");
}
/**
* @see DATAMONGO-725
*/
@Test
@Test // DATAMONGO-725
public void hasCustomTypeMapper() {
loadValidConfiguration();
@@ -81,10 +75,7 @@ public class MappingMongoConverterParserIntegrationTests {
assertThat(converter.getTypeMapper(), is(customMongoTypeMapper));
}
/**
* @see DATAMONGO-301
*/
@Test
@Test // DATAMONGO-301
public void scansForConverterAndSetsUpCustomConversionsAccordingly() {
loadValidConfiguration();
@@ -93,10 +84,7 @@ public class MappingMongoConverterParserIntegrationTests {
assertThat(conversions.hasCustomWriteTarget(Account.class), is(true));
}
/**
* @see DATAMONGO-607
*/
@Test
@Test // DATAMONGO-607
public void activatesAbbreviatingPropertiesCorrectly() {
loadValidConfiguration();
@@ -108,10 +96,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);
@@ -123,10 +108,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);
@@ -135,18 +117,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");
}

View File

@@ -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 <mongo:mapping-converter />} 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"));

View File

@@ -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);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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<MongoCredential>) 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<MongoCredential>) 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<MongoCredential>) 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<MongoCredential>) 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<MongoCredential>) 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<MongoCredential>) 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<MongoCredential>) 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<MongoCredential>) 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");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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"));
}

View File

@@ -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"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,10 +66,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"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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");

View File

@@ -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]";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ import com.mongodb.client.MongoCursor;
* Unit tests for {@link CloseableIterableCursorAdapter}.
*
* @author Oliver Gierke
* @see DATAMONGO-1276
*/
@RunWith(MockitoJUnitRunner.class)
public class CloseableIterableCursorAdapterUnitTests {
@@ -52,30 +51,21 @@ public class CloseableIterableCursorAdapterUnitTests {
this.adapter = new CloseableIterableCursorAdapter<Object>(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();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,34 +63,22 @@ public class DefaultBulkOperationsIntegrationTests {
this.collection.deleteMany(new Document());
}
/**
* @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<BaseDoc> documents = Arrays.asList(newDoc("1"), newDoc("2"));
@@ -98,10 +86,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<BaseDoc> documents = Arrays.asList(newDoc("1"), newDoc("1"), newDoc("2"));
@@ -116,10 +101,7 @@ public class DefaultBulkOperationsIntegrationTests {
}
}
/**
* @see DATAMONGO-934
*/
@Test
@Test // DATAMONGO-934
public void insertUnOrdered() {
List<BaseDoc> documents = Arrays.asList(newDoc("1"), newDoc("2"));
@@ -127,10 +109,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<BaseDoc> documents = Arrays.asList(newDoc("1"), newDoc("1"), newDoc("2"));
@@ -145,10 +124,7 @@ public class DefaultBulkOperationsIntegrationTests {
}
}
/**
* @see DATAMONGO-934
*/
@Test
@Test // DATAMONGO-934
public void upsertDoesUpdate() {
insertSomeDocuments();
@@ -165,10 +141,7 @@ public class DefaultBulkOperationsIntegrationTests {
assertThat(result.getUpserts().size(), is(0));
}
/**
* @see DATAMONGO-934
*/
@Test
@Test // DATAMONGO-934
public void upsertDoesInsert() {
com.mongodb.bulk.BulkWriteResult result = createBulkOps(BulkMode.ORDERED).//
@@ -182,60 +155,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() {
com.mongodb.bulk.BulkWriteResult result = createBulkOps(BulkMode.ORDERED).insert(newDoc("1", "v1")).//
@@ -269,10 +222,7 @@ public class DefaultBulkOperationsIntegrationTests {
assertThat(result.getDeletedCount(), is(1));
}
/**
* @see DATAMONGO-1534
*/
@Test
@Test // DATAMONGO-1534
public void insertShouldConsiderInheritance() {
SpecialDoc specialDoc = new SpecialDoc();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,10 +79,7 @@ public class DefaultIndexOperationsIntegrationTests {
}
}
/**
* @see DATAMONGO-1008
*/
@Test
@Test // DATAMONGO-1008
public void getIndexInfoShouldBeAbleToRead2dsphereIndex() {
collection.createIndex(GEO_SPHERE_2D);
@@ -91,10 +88,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));
@@ -108,10 +102,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));
@@ -125,10 +116,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));
@@ -142,10 +130,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));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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("");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,18 +29,12 @@ import org.junit.Test;
*/
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 Document("stats", null));
@@ -50,10 +44,7 @@ public class GeoCommandStatisticsUnitTests {
assertThat(statistics.getAverageDistance(), is(Double.NaN));
}
/**
* @see DATAMONGO-1361
*/
@Test
@Test // DATAMONGO-1361
public void returnsAverageDistanceIfPresent() {
GeoCommandStatistics statistics = GeoCommandStatistics

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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);

View File

@@ -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.
@@ -90,10 +90,7 @@ public class MongoDbUtilsIntegrationTests {
});
}
/**
* @see DATAMONGO-585
*/
@Test
@Test // DATAMONGO-585
public void authenticatesCorrectlyInMultithreadedEnvironment() throws Exception {
// Create sample user
@@ -132,10 +129,7 @@ public class MongoDbUtilsIntegrationTests {
}
}
/**
* @see DATAMONGO-789
*/
@Test
@Test // DATAMONGO-789
public void authenticatesCorrectlyWithAuthenticationDB() throws Exception {
// Create sample user

View File

@@ -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() {

View File

@@ -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);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -292,10 +292,7 @@ public abstract class MongoOperationsUnitTests {
}.assertDataAccessException();
}
/**
* @see DATAMONGO-341
*/
@Test
@Test // DATAMONGO-341
public void geoNearRejectsNullNearQuery() {
new Execution() {
@@ -306,10 +303,7 @@ public abstract class MongoOperationsUnitTests {
}.assertDataAccessException();
}
/**
* @see DATAMONGO-341
*/
@Test
@Test // DATAMONGO-341
public void geoNearRejectsNullNearQueryifCollectionGiven() {
new Execution() {
@@ -320,10 +314,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));
@@ -336,10 +327,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));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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();

View File

@@ -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.
@@ -149,20 +149,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();
@@ -171,10 +165,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
template.save(entity);
}
/**
* @see DATAMONGO-322
*/
@Test
@Test // DATAMONGO-322
public void autogeneratesIdForEntityWithAutogeneratableId() {
this.converter.afterPropertiesSet();
@@ -189,10 +180,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));
@@ -212,10 +200,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
// anyBoolean());
}
/**
* @see DATAMONGO-474
*/
@Test
@Test // DATAMONGO-474
public void setsUnpopulatedIdField() {
NotAutogenerateableId entity = new NotAutogenerateableId();
@@ -224,10 +209,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();
@@ -237,10 +219,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();
@@ -259,10 +238,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
Assert.assertThat(captor.getValue().get("$inc"), Is.<Object> is(new org.bson.Document("version", 1L)));
}
/**
* @see DATAMONGO-868
*/
@Test
@Test // DATAMONGO-868
public void findAndModifyShouldNotBumpVersionByOneWhenVersionFieldAlreadyIncludedInUpdate() {
VersionedEntity v = new VersionedEntity();
@@ -283,10 +259,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();
@@ -313,10 +286,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
}));
}
/**
* @see DATAMONGO-566
*/
@Test
@Test // DATAMONGO-566
public void findAllAndRemoveShouldRetrieveMatchingDocumentsPriorToRemoval() {
BasicQuery query = new BasicQuery("{'foo':'bar'}");
@@ -324,10 +294,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);
@@ -345,20 +312,14 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
IsIterableContainingInOrder.<Object> contains(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()).deleteMany(Mockito.any(org.bson.Document.class));
}
/**
* @see DATAMONGO-948
*/
@Test
@Test // DATAMONGO-948
public void sortShouldBeTakenAsIsWhenExecutingQueryWithoutSpecificTypeInformation() {
Query query = Query.query(Criteria.where("foo").is("bar")).with(new Sort("foo"));
@@ -376,10 +337,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
assertThat(captor.getValue(), equalTo(new org.bson.Document("foo", 1)));
}
/**
* @see DATAMONGO-1166
*/
@Test
@Test // DATAMONGO-1166
public void aggregateShouldHonorReadPreferenceWhenSet() {
when(db.runCommand(Mockito.any(org.bson.Document.class), Mockito.any(ReadPreference.class)))
@@ -394,10 +352,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
eq(Document.class));
}
/**
* @see DATAMONGO-1166
*/
@Test
@Test // DATAMONGO-1166
public void aggregateShouldIgnoreReadPreferenceWhenNotSet() {
when(db.runCommand(Mockito.any(org.bson.Document.class), Mockito.any(ReadPreference.class)))
@@ -410,10 +365,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
verify(this.db, times(1)).runCommand(Mockito.any(org.bson.Document.class), eq(org.bson.Document.class));
}
/**
* @see DATAMONGO-1166
*/
@Test
@Test // DATAMONGO-1166
public void geoNearShouldHonorReadPreferenceWhenSet() {
when(db.runCommand(Mockito.any(org.bson.Document.class), Mockito.any(ReadPreference.class)))
@@ -429,10 +381,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
eq(Document.class));
}
/**
* @see DATAMONGO-1166
*/
@Test
@Test // DATAMONGO-1166
public void geoNearShouldIgnoreReadPreferenceWhenNotSet() {
when(db.runCommand(Mockito.any(Document.class), Mockito.any(ReadPreference.class)))
@@ -445,10 +394,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
verify(this.db, times(1)).runCommand(Mockito.any(Document.class), eq(Document.class));
}
/**
* @see DATAMONGO-1334
*/
@Test
@Test // DATAMONGO-1334
@Ignore("TODO: mongo3 - a bit hard to tests with the immutable object stuff")
public void mapReduceShouldUseZeroAsDefaultLimit() {
@@ -469,10 +415,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
verify(output, times(1)).limit(1);
}
/**
* @see DATAMONGO-1334
*/
@Test
@Test // DATAMONGO-1334
public void mapReduceShouldPickUpLimitFromQuery() {
MongoCursor cursor = mock(MongoCursor.class);
@@ -493,10 +436,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
verify(output, times(1)).limit(100);
}
/**
* @see DATAMONGO-1334
*/
@Test
@Test // DATAMONGO-1334
public void mapReduceShouldPickUpLimitFromOptions() {
MongoCursor cursor = mock(MongoCursor.class);
@@ -517,10 +457,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
verify(output, times(1)).limit(1000);
}
/**
* @see DATAMONGO-1334
*/
@Test
@Test // DATAMONGO-1334
public void mapReduceShouldPickUpLimitFromOptionsWhenQueryIsNotPresent() {
MongoCursor cursor = mock(MongoCursor.class);
@@ -539,10 +476,7 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
verify(output, times(1)).limit(1000);
}
/**
* @see DATAMONGO-1334
*/
@Test
@Test // DATAMONGO-1334
public void mapReduceShouldPickUpLimitFromOptionsEvenWhenQueryDefinesItDifferently() {
MongoCursor cursor = mock(MongoCursor.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,10 +66,7 @@ public class QueryCursorPreparerUnitTests {
when(cursor.partial(anyBoolean())).thenReturn(cursor);
}
/**
* @see DATAMONGO-185
*/
@Test
@Test // DATAMONGO-185
public void appliesHintsCorrectly() {
Query query = query(where("foo").is("bar")).withHint("hint");
@@ -81,10 +78,7 @@ public class QueryCursorPreparerUnitTests {
assertThat(captor.getValue(), equalTo(new Document("$hint", "hint")));
}
/**
* @see DATAMONGO-957
*/
@Test
@Test // DATAMONGO-957
public void doesNotApplyMetaWhenEmpty() {
Query query = query(where("foo").is("bar"));
@@ -95,10 +89,7 @@ public class QueryCursorPreparerUnitTests {
verify(cursorToUse, never()).modifiers(any(Document.class));
}
/**
* @see DATAMONGO-957
*/
@Test
@Test // DATAMONGO-957
public void appliesMaxScanCorrectly() {
Query query = query(where("foo").is("bar")).maxScan(100);
@@ -110,10 +101,7 @@ public class QueryCursorPreparerUnitTests {
assertThat(captor.getValue(), equalTo(new Document("$maxScan", 100L)));
}
/**
* @see DATAMONGO-957
*/
@Test
@Test // DATAMONGO-957
public void appliesMaxTimeCorrectly() {
Query query = query(where("foo").is("bar")).maxTime(1, TimeUnit.SECONDS);
@@ -125,10 +113,7 @@ public class QueryCursorPreparerUnitTests {
assertThat(captor.getValue(), equalTo(new Document("$maxTimeMS", 1000L)));
}
/**
* @see DATAMONGO-957
*/
@Test
@Test // DATAMONGO-957
public void appliesCommentCorrectly() {
Query query = query(where("foo").is("bar")).comment("spring data");
@@ -140,10 +125,7 @@ public class QueryCursorPreparerUnitTests {
assertThat(captor.getValue(), equalTo(new Document("$comment", "spring data")));
}
/**
* @see DATAMONGO-957
*/
@Test
@Test // DATAMONGO-957
public void appliesSnapshotCorrectly() {
Query query = query(where("foo").is("bar")).useSnapshot();
@@ -156,10 +138,7 @@ public class QueryCursorPreparerUnitTests {
}
/**
* @see DATAMONGO-1480
*/
@Test
@Test // DATAMONGO-1480
public void appliesNoCursorTimeoutCorrectly() {
Query query = query(where("foo").is("bar")).noCursorTimeout();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,10 +83,7 @@ public class ReactiveMongoTemplateExecuteTests {
operations.dropCollection("execute_index_test").block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeCommandJsonCommandShouldReturnSingleResponse() throws Exception {
Document document = operations.executeCommand("{ buildInfo: 1 }").block();
@@ -94,10 +91,7 @@ public class ReactiveMongoTemplateExecuteTests {
assertThat(document, hasKey("version"));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeCommandDocumentCommandShouldReturnSingleResponse() throws Exception {
Document document = operations.executeCommand(new Document("buildInfo", 1)).block();
@@ -105,10 +99,7 @@ public class ReactiveMongoTemplateExecuteTests {
assertThat(document, hasKey("version"));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeCommandJsonCommandShouldReturnMultipleResponses() throws Exception {
assumeTrue(mongoVersion.isGreaterThan(THREE));
@@ -126,10 +117,7 @@ public class ReactiveMongoTemplateExecuteTests {
});
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeCommandJsonCommandShouldTranslateExceptions() throws Exception {
TestSubscriber<Document> testSubscriber = TestSubscriber.subscribe(operations.executeCommand("{ unknown: 1 }"));
@@ -137,10 +125,7 @@ public class ReactiveMongoTemplateExecuteTests {
testSubscriber.await().assertError(InvalidDataAccessApiUsageException.class);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeCommandDocumentCommandShouldTranslateExceptions() throws Exception {
TestSubscriber<Document> testSubscriber = TestSubscriber
@@ -149,10 +134,7 @@ public class ReactiveMongoTemplateExecuteTests {
testSubscriber.await().assertError(InvalidDataAccessApiUsageException.class);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeCommandWithReadPreferenceCommandShouldTranslateExceptions() throws Exception {
TestSubscriber<Document> testSubscriber = TestSubscriber
@@ -161,10 +143,7 @@ public class ReactiveMongoTemplateExecuteTests {
testSubscriber.await().assertError(InvalidDataAccessApiUsageException.class);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeOnDatabaseShouldExecuteCommand() throws Exception {
operations.executeCommand("{ insert: 'execute_test', documents: [{},{},{}]}").block();
@@ -179,10 +158,7 @@ public class ReactiveMongoTemplateExecuteTests {
assertThat(documents, hasSize(3));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeOnDatabaseShouldDeferExecution() throws Exception {
operations.execute(db -> {
@@ -192,10 +168,7 @@ public class ReactiveMongoTemplateExecuteTests {
// the assertion here is that the exception is not thrown
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeOnDatabaseShouldShouldTranslateExceptions() throws Exception {
TestSubscriber<Document> testSubscriber = TestSubscriber.create();
@@ -209,10 +182,7 @@ public class ReactiveMongoTemplateExecuteTests {
testSubscriber.await().assertError(UncategorizedMongoDbException.class);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeOnCollectionWithTypeShouldReturnFindResults() throws Exception {
operations.executeCommand("{ insert: 'person', documents: [{},{},{}]}").block();
@@ -225,10 +195,7 @@ public class ReactiveMongoTemplateExecuteTests {
testSubscriber.awaitAndAssertNextValueCount(3).assertComplete();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executeOnCollectionWithNameShouldReturnFindResults() throws Exception {
operations.executeCommand("{ insert: 'execute_test', documents: [{},{},{}]}").block();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,10 +74,7 @@ public class ReactiveMongoTemplateIndexTests {
template.dropCollection(Person.class).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void testEnsureIndexShouldCreateIndex() {
Person p1 = new Person("Oliver");
@@ -106,10 +103,7 @@ public class ReactiveMongoTemplateIndexTests {
assertThat(unique, is(true));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void getIndexInfoShouldReturnCorrectIndex() {
Person p1 = new Person("Oliver");
@@ -132,10 +126,7 @@ public class ReactiveMongoTemplateIndexTests {
assertThat(field, is(IndexField.create("age", Direction.DESC)));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void testReadIndexInfoForIndicesCreatedViaMongoShellCommands() {
String command = "db." + template.getCollectionName(Person.class)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,10 +107,7 @@ public class ReactiveMongoTemplateTests {
.and(template.dropCollection(Sample.class)).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertSetsId() throws Exception {
PersonWithAList person = new PersonWithAList();
@@ -121,10 +118,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.getId(), is(notNullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertAllSetsId() throws Exception {
PersonWithAList person = new PersonWithAList();
@@ -135,10 +129,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.getId(), is(notNullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertCollectionSetsId() throws Exception {
PersonWithAList person = new PersonWithAList();
@@ -149,10 +140,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.getId(), is(notNullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void saveSetsId() throws Exception {
PersonWithAList person = new PersonWithAList();
@@ -163,10 +151,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.getId(), is(notNullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertsSimpleEntityCorrectly() throws Exception {
Person person = new Person("Mark");
@@ -181,10 +166,7 @@ public class ReactiveMongoTemplateTests {
testSubscriber.assertValues(person);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void simpleInsertDoesNotAllowArrays() throws Exception {
thrown.expect(IllegalArgumentException.class);
@@ -194,10 +176,7 @@ public class ReactiveMongoTemplateTests {
template.insert(new Person[] { person });
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void simpleInsertDoesNotAllowCollections() throws Exception {
thrown.expect(IllegalArgumentException.class);
@@ -207,10 +186,7 @@ public class ReactiveMongoTemplateTests {
template.insert(Collections.singletonList(person));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertsSimpleEntityWithSuppliedCollectionNameCorrectly() throws Exception {
Person person = new Person("Homer");
@@ -225,10 +201,7 @@ public class ReactiveMongoTemplateTests {
testSubscriber.assertValues(person);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertBatchCorrectly() throws Exception {
List<Person> persons = Arrays.asList(new Person("Dick", 22), new Person("Harry", 23), new Person("Tom", 21));
@@ -243,10 +216,7 @@ public class ReactiveMongoTemplateTests {
testSubscriber.assertValues(persons.toArray(new Person[persons.size()]));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertBatchWithSuppliedCollectionNameCorrectly() throws Exception {
List<Person> persons = Arrays.asList(new Person("Dick", 22), new Person("Harry", 23), new Person("Tom", 21));
@@ -261,10 +231,7 @@ public class ReactiveMongoTemplateTests {
testSubscriber.assertValues(persons.toArray(new Person[persons.size()]));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void insertBatchWithSuppliedEntityTypeCorrectly() throws Exception {
List<Person> persons = Arrays.asList(new Person("Dick", 22), new Person("Harry", 23), new Person("Tom", 21));
@@ -279,10 +246,7 @@ public class ReactiveMongoTemplateTests {
testSubscriber.assertValues(persons.toArray(new Person[persons.size()]));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void testAddingToList() {
PersonWithAList p = new PersonWithAList();
@@ -317,10 +281,7 @@ public class ReactiveMongoTemplateTests {
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void testFindOneWithSort() {
PersonWithAList p = new PersonWithAList();
p.setFirstName("Sven");
@@ -344,10 +305,7 @@ public class ReactiveMongoTemplateTests {
assertThat(p5.getFirstName(), is("Mark"));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void bogusUpdateDoesNotTriggerException() throws Exception {
ReactiveMongoTemplate mongoTemplate = new ReactiveMongoTemplate(factory);
@@ -362,10 +320,7 @@ public class ReactiveMongoTemplateTests {
mongoTemplate.updateFirst(q, u, Person.class).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void updateFirstByEntityTypeShouldUpdateObject() throws Exception {
Person person = new Person("Oliver2", 25);
@@ -379,10 +334,7 @@ public class ReactiveMongoTemplateTests {
});
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void updateFirstByCollectionNameShouldUpdateObjects() throws Exception {
Person person = new Person("Oliver2", 25);
@@ -396,10 +348,7 @@ public class ReactiveMongoTemplateTests {
});
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void updateMultiByEntityTypeShouldUpdateObjects() throws Exception {
Query query = new Query(
@@ -412,10 +361,7 @@ public class ReactiveMongoTemplateTests {
.awaitAndAssertNextValueCount(2);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void updateMultiByCollectionNameShouldUpdateObject() throws Exception {
Query query = new Query(
@@ -430,10 +376,7 @@ public class ReactiveMongoTemplateTests {
.awaitAndAssertNextValueCount(2);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void throwsExceptionForDuplicateIds() {
ReactiveMongoTemplate template = new ReactiveMongoTemplate(factory);
@@ -452,10 +395,7 @@ public class ReactiveMongoTemplateTests {
}
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void throwsExceptionForUpdateWithInvalidPushOperator() {
ReactiveMongoTemplate template = new ReactiveMongoTemplate(factory);
@@ -477,10 +417,7 @@ public class ReactiveMongoTemplateTests {
template.updateFirst(query, upd, Person.class).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void rejectsDuplicateIdInInsertAll() {
thrown.expect(DataIntegrityViolationException.class);
@@ -500,10 +437,7 @@ public class ReactiveMongoTemplateTests {
template.insertAll(records).next().block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void testFindAndUpdate() {
template.insertAll(Arrays.asList(new Person("Tom", 21), new Person("Dick", 22), new Person("Harry", 23))).next()
@@ -538,10 +472,7 @@ public class ReactiveMongoTemplateTests {
assertThat(p.getAge(), is(1));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void testFindAllAndRemoveFullyReturnsAndRemovesDocuments() {
Sample spring = new Sample("100", "spring");
@@ -560,10 +491,7 @@ public class ReactiveMongoTemplateTests {
assertThat(template.findOne(new Query(), Sample.class).block(), is(equalTo(data)));
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = OptimisticLockingFailureException.class)
@Test(expected = OptimisticLockingFailureException.class) // DATAMONGO-1444
public void optimisticLockingHandling() {
// Init version
@@ -598,10 +526,7 @@ public class ReactiveMongoTemplateTests {
template.save(person).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void optimisticLockingHandlingWithExistingId() {
PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger();
@@ -611,10 +536,7 @@ public class ReactiveMongoTemplateTests {
template.save(person);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void doesNotFailOnVersionInitForUnversionedEntity() {
Document dbObject = new Document();
@@ -623,10 +545,7 @@ public class ReactiveMongoTemplateTests {
template.insert(dbObject, template.determineCollectionName(PersonWithVersionPropertyOfTypeInteger.class));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void removesObjectFromExplicitCollection() {
String collectionName = "explicit";
@@ -641,10 +560,7 @@ public class ReactiveMongoTemplateTests {
assertThat(template.findAll(PersonWithConvertedId.class, collectionName).next().block(), is(nullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void savesMapCorrectly() {
Map<String, String> map = new HashMap<>();
@@ -653,26 +569,17 @@ public class ReactiveMongoTemplateTests {
template.save(map, "maps").block();
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = MappingException.class)
@Test(expected = MappingException.class) // DATAMONGO-1444
public void savesMongoPrimitiveObjectCorrectly() {
template.save(new Object(), "collection").block();
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1444
public void rejectsNullObjectToBeSaved() {
template.save((Object) null);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void savesPlainDbObjectCorrectly() {
Document dbObject = new Document("foo", "bar");
@@ -681,10 +588,7 @@ public class ReactiveMongoTemplateTests {
assertThat(dbObject.containsKey("_id"), is(true));
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = InvalidDataAccessApiUsageException.class)
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAMONGO-1444
public void rejectsPlainObjectWithOutExplicitCollection() {
Document dbObject = new Document("foo", "bar");
@@ -693,10 +597,7 @@ public class ReactiveMongoTemplateTests {
template.findById(dbObject.get("_id"), Document.class).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void readsPlainDbObjectById() {
Document dbObject = new Document("foo", "bar");
@@ -707,10 +608,7 @@ public class ReactiveMongoTemplateTests {
assertThat(result.get("_id"), is(dbObject.get("_id")));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void geoNear() {
List<Venue> venues = Arrays.asList(new Venue("Penn Station", -73.99408, 40.75057), //
@@ -736,26 +634,17 @@ public class ReactiveMongoTemplateTests {
.assertValueCount(3);
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void writesPlainString() {
template.save("{ 'foo' : 'bar' }", "collection").block();
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = MappingException.class)
@Test(expected = MappingException.class) // DATAMONGO-1444
public void rejectsNonJsonStringForSave() {
template.save("Foobar!", "collection").block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void initializesVersionOnInsert() {
PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger();
@@ -766,10 +655,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.version, is(0));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void initializesVersionOnBatchInsert() {
PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger();
@@ -780,10 +666,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.version, is(0));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void queryCantBeNull() {
List<PersonWithIdPropertyOfTypeObjectId> result = Flux
@@ -791,10 +674,7 @@ public class ReactiveMongoTemplateTests {
assertThat(template.find(null, PersonWithIdPropertyOfTypeObjectId.class).collectList().block(), is(result));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void versionsObjectIntoDedicatedCollection() {
PersonWithVersionPropertyOfTypeInteger person = new PersonWithVersionPropertyOfTypeInteger();
@@ -807,10 +687,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.version, is(1));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void correctlySetsLongVersionProperty() {
PersonWithVersionPropertyOfTypeLong person = new PersonWithVersionPropertyOfTypeLong();
@@ -820,10 +697,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.version, is(0L));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void throwsExceptionForIndexViolationIfConfigured() {
ReactiveMongoTemplate template = new ReactiveMongoTemplate(factory);
@@ -846,10 +720,7 @@ public class ReactiveMongoTemplateTests {
}
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = DuplicateKeyException.class)
@Test(expected = DuplicateKeyException.class) // DATAMONGO-1444
public void preventsDuplicateInsert() {
template.setWriteConcern(WriteConcern.MAJORITY);
@@ -864,10 +735,7 @@ public class ReactiveMongoTemplateTests {
template.save(person).block();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void countAndFindWithoutTypeInformation() {
Person person = new Person();
@@ -880,10 +748,7 @@ public class ReactiveMongoTemplateTests {
assertThat(template.count(query, collectionName).block(), is(1L));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void nullsPropertiesForVersionObjectUpdates() {
VersionedPerson person = new VersionedPerson();
@@ -900,10 +765,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.lastname, is(nullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void nullsValuesForUpdatesOfUnversionedEntity() {
Person person = new Person("Dave");
@@ -916,10 +778,7 @@ public class ReactiveMongoTemplateTests {
assertThat(person.getFirstName(), is(nullValue()));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void savesJsonStringCorrectly() {
Document dbObject = new Document().append("first", "first").append("second", "second");
@@ -930,10 +789,7 @@ public class ReactiveMongoTemplateTests {
assertThat(result.containsKey("first"), is(true));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void executesExistsCorrectly() {
Sample sample = new Sample();
@@ -947,10 +803,7 @@ public class ReactiveMongoTemplateTests {
assertThat(template.exists(query, Sample.class, template.getCollectionName(Sample.class)).block(), is(true));
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void tailStreamsData() throws InterruptedException {
template.dropCollection("capped").block();
@@ -969,10 +822,7 @@ public class ReactiveMongoTemplateTests {
cancellation.dispose();
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void tailStreamsDataUntilCancellation() throws InterruptedException {
template.dropCollection("capped").block();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,26 +58,17 @@ public class ReactiveMongoTemplateUnitTests {
this.template = new ReactiveMongoTemplate(factory, converter);
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1444
public void rejectsNullDatabaseName() throws Exception {
new ReactiveMongoTemplate(mongoClient, null);
}
/**
* @see DATAMONGO-1444
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1444
public void rejectsNullMongo() throws Exception {
new ReactiveMongoTemplate(null, "database");
}
/**
* @see DATAMONGO-1444
*/
@Test
@Test // DATAMONGO-1444
public void defaultsConverterToMappingMongoConverter() throws Exception {
ReactiveMongoTemplate template = new ReactiveMongoTemplate(mongoClient, "database");
assertTrue(ReflectionTestUtils.getField(template, "mongoConverter") instanceof MappingMongoConverter);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,10 +63,7 @@ public class SerializationUtilsUnitTests {
assertThat(serializeToJsonSafely(document), is(expectedOutput));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void flattenMapShouldFlatOutNestedStructureCorrectly() {
Document document = new Document();
@@ -77,10 +74,7 @@ public class SerializationUtilsUnitTests {
assertThat(flattenMap(document), hasEntry("nested.value", (Object) "conflux"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void flattenMapShouldFlatOutNestedStructureWithListCorrectly() {
BasicDBList dbl = new BasicDBList();
@@ -94,10 +88,7 @@ public class SerializationUtilsUnitTests {
assertThat(flattenMap(document), hasEntry("nested.value", (Object) dbl));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void flattenMapShouldLeaveKeywordsUntouched() {
Document document = new Document();
@@ -111,10 +102,7 @@ public class SerializationUtilsUnitTests {
assertThat(((Map<String, Object>) map.get("nested")).get("$regex"), is((Object) "^conflux$"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void flattenMapShouldAppendCommandsCorrectly() {
Document document = new Document();
@@ -132,10 +120,7 @@ public class SerializationUtilsUnitTests {
assertThat(((Map<String, Object>) map.get("nested")).get("$options"), is((Object) "i"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void flattenMapShouldReturnEmptyMapWhenSourceIsNull() {
assertThat(flattenMap(null).isEmpty(), is(true));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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("", ""));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,10 +40,7 @@ public class AggregationOptionsTests {
}
/**
* @see DATAMONGO-960
*/
@Test
@Test // DATAMONGO-960
public void aggregationOptionsBuilderShouldSetOptionsAccordingly() {
assertThat(aggregationOptions.isAllowDiskUse(), is(true));
@@ -51,10 +48,7 @@ public class AggregationOptionsTests {
assertThat(aggregationOptions.getCursor(), is(new Document("foo", 1)));
}
/**
* @see DATAMONGO-960
*/
@Test
@Test // DATAMONGO-960
public void aggregationOptionsToString() {
assertThat(aggregationOptions.toDocument(),
is(Document.parse("{ \"allowDiskUse\" : true , \"explain\" : true , \"cursor\" : { \"foo\" : 1}}")));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,8 +75,7 @@ import com.mongodb.client.MongoCollection;
/**
* Tests for {@link MongoTemplate#aggregate(String, AggregationPipeline, Class)}.
*
* @see DATAMONGO-586
*
* @author Tobias Trelle
* @author Thomas Darimont
* @author Oliver Gierke
@@ -144,10 +143,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 <a href="http://docs.mongodb.org/manual/tutorial/aggregation-examples/">MongoDB Aggregation Examples</a>
*/
private void initSampleDataIfNecessary() {
@@ -186,22 +185,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();
@@ -230,7 +229,7 @@ public class AggregationTests {
assertTagCount("nosql", 1, tagCount.get(2));
}
@Test
@Test // DATAMONGO-586
public void shouldAggregateEmptyCollection() {
Aggregation aggregation = newAggregation(//
@@ -253,10 +252,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));
@@ -284,10 +280,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));
@@ -315,7 +308,7 @@ public class AggregationTests {
assertThat(tagCount.get(3), isBsonObject().notContaining("n"));
}
@Test
@Test // DATAMONGO-586
public void shouldDetectResultMismatch() {
createTagDocuments();
@@ -340,7 +333,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
@@ -448,7 +441,7 @@ public class AggregationTests {
assertThat(lastZipInfoStats.biggestCity.population, is(70185));
}
@Test
@Test // DATAMONGO-586
public void findStatesWithPopulationOver10MillionAggregationExample() {
/*
//complex mongodb aggregation framework example from
@@ -495,10 +488,10 @@ public class AggregationTests {
}
/**
* @see DATAMONGO-861
* @see https://docs.mongodb.com/manual/reference/operator/aggregation/cond/#example
* @see <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/cond/#example">MongoDB Aggregation
* Framework: $cond</a>
*/
@Test
@Test // DATAMONGO-861
public void aggregationUsingConditionalProjectionToCalculateDiscount() {
/*
@@ -548,10 +541,10 @@ public class AggregationTests {
}
/**
* @see DATAMONGO-861
* @see https://docs.mongodb.com/manual/reference/operator/aggregation/ifNull/#example
* @see <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/ifNull/#example">MongoDB Aggregation
* Framework: $ifNull</a>
*/
@Test
@Test // DATAMONGO-861
public void aggregationUsingIfNullToProjectSaneDefaults() {
/*
@@ -591,10 +584,7 @@ public class AggregationTests {
assertThat(second.get("description"), is((Object) "Unspecified"));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void aggregationUsingConditionalProjection() {
TypedAggregation<ZipInfo> aggregation = newAggregation(ZipInfo.class, //
@@ -616,10 +606,7 @@ public class AggregationTests {
assertThat(firstZipInfoStats.get("population"), is((Object) 6055));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void aggregationUsingNestedConditionalProjection() {
TypedAggregation<ZipInfo> aggregation = newAggregation(ZipInfo.class, //
@@ -642,10 +629,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));
@@ -669,10 +653,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));
@@ -696,10 +677,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);
@@ -743,9 +721,11 @@ public class AggregationTests {
}
/**
* @see http://docs.mongodb.org/manual/tutorial/aggregation-examples/#return-the-five-most-common-likes
* @see <a href=
* "https://docs.mongodb.com/manual/tutorial/aggregation-with-user-preference-data/#return-the-five-most-common-likes">Return
* the Five Most Common “Likes”</a>
*/
@Test
@Test // DATAMONGO-586
public void returnFiveMostCommonLikesAggregationFrameworkExample() {
createUserWithLikesDocuments();
@@ -777,7 +757,7 @@ public class AggregationTests {
);
}
@Test
@Test // DATAMONGO-586
public void arithmenticOperatorsInProjectionExample() {
Product product = new Product("P1", "A", 1.99, 3, 0.05, 0.19);
@@ -819,10 +799,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);
@@ -854,10 +831,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));
@@ -879,10 +853,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);
@@ -924,12 +895,11 @@ public class AggregationTests {
}
/**
* @see DATAMONGO-753
* @see http
* ://stackoverflow.com/questions/18653574/spring-data-mongodb-aggregation-framework-invalid-reference-in-group
* -operati
* @see <a href=
* "http://stackoverflow.com/questions/18653574/spring-data-mongodb-aggregation-framework-invalid-reference-in-group-operati">Spring
* Data MongoDB - Aggregation Framework - invalid reference in group Operation</a>
*/
@Test
@Test // DATAMONGO-753
public void allowsNestedFieldReferencesAsGroupIdsInGroupExpressions() {
mongoTemplate.insert(new DATAMONGO753().withPDs(new PD("A", 1), new PD("B", 1), new PD("C", 1)));
@@ -954,12 +924,11 @@ public class AggregationTests {
}
/**
* @see DATAMONGO-753
* @see http
* ://stackoverflow.com/questions/18653574/spring-data-mongodb-aggregation-framework-invalid-reference-in-group
* -operati
* @see <a href=
* "http://stackoverflow.com/questions/18653574/spring-data-mongodb-aggregation-framework-invalid-reference-in-group-operati">Spring
* Data MongoDB - Aggregation Framework - invalid reference in group Operation</a>
*/
@Test
@Test // DATAMONGO-753
public void aliasesNestedFieldInProjectionImmediately() {
mongoTemplate.insert(new DATAMONGO753().withPDs(new PD("A", 1), new PD("B", 1), new PD("C", 1)));
@@ -978,10 +947,7 @@ public class AggregationTests {
}
}
/**
* @DATAMONGO-774
*/
@Test
@Test // DATAMONGO-774
public void shouldPerformDateProjectionOperatorsCorrectly() throws ParseException {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR));
@@ -1010,10 +976,7 @@ public class AggregationTests {
assertThat((String) document.get("toUpper"), is("ABC"));
}
/**
* @DATAMONGO-774
*/
@Test
@Test // DATAMONGO-774
public void shouldPerformStringProjectionOperatorsCorrectly() throws ParseException {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR));
@@ -1052,10 +1015,7 @@ public class AggregationTests {
assertThat((Integer) document.get("millisecond"), is(789));
}
/**
* @see DATAMONGO-1550
*/
@Test
@Test // DATAMONGO-1550
public void shouldPerformReplaceRootOperatorCorrectly() throws ParseException {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR));
@@ -1078,10 +1038,7 @@ public class AggregationTests {
assertThat((Integer) resultDocument.keySet().size(), is(1));
}
/**
* @see DATAMONGO-788
*/
@Test
@Test // DATAMONGO-788
public void referencesToGroupIdsShouldBeRenderedProperly() {
mongoTemplate.insert(new DATAMONGO788(1, 1));
@@ -1108,10 +1065,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);
@@ -1142,10 +1096,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);
@@ -1182,10 +1133,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);
@@ -1216,10 +1164,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));
@@ -1244,10 +1189,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));
@@ -1267,10 +1209,7 @@ public class AggregationTests {
assertThat(rawResult.containsKey("stages"), is(true));
}
/**
* @see DATAMONGO-954
*/
@Test
@Test // DATAMONGO-954
public void shouldSupportReturningCurrentAggregationRoot() {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX));
@@ -1295,11 +1234,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));
@@ -1320,10 +1257,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));
@@ -1344,10 +1278,7 @@ public class AggregationTests {
assertThat(document, isBsonObject().containing("documents", 3).containing("twice", 6));
}
/**
* @see DATAMONGO-975
*/
@Test
@Test // DATAMONGO-975
public void shouldRetrieveDateTimeFragementsCorrectly() throws Exception {
mongoTemplate.dropCollection(ObjectWithDate.class);
@@ -1399,10 +1330,7 @@ public class AggregationTests {
assertThat(document.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));
@@ -1423,10 +1351,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));
@@ -1446,10 +1371,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));
@@ -1470,10 +1392,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));
@@ -1495,10 +1414,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));
@@ -1527,10 +1443,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()), //
@@ -1539,10 +1452,7 @@ public class AggregationTests {
skip(100L));
}
/**
* @see DATAMONGO-1457
*/
@Test
@Test // DATAMONGO-1457
public void sliceShouldBeAppliedCorrectly() {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
@@ -1560,10 +1470,7 @@ public class AggregationTests {
}
}
/**
* @see DATAMONGO-1491
*/
@Test
@Test // DATAMONGO-1491
public void filterShouldBeAppliedCorrectly() {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
@@ -1596,10 +1503,7 @@ public class AggregationTests {
Sales.builder().id("2").items(Collections.<Item> emptyList()).build()));
}
/**
* @see DATAMONGO-1538
*/
@Test
@Test // DATAMONGO-1538
public void letShouldBeAppliedCorrectly() {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
@@ -1625,10 +1529,7 @@ public class AggregationTests {
new Document("_id", "2").append("finalTotal", 10.25D)));
}
/**
* @see DATAMONGO-1551
*/
@Test
@Test // DATAMONGO-1551
public void graphLookupShouldBeAppliedCorrectly() {
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR));
@@ -1659,10 +1560,7 @@ public class AggregationTests {
assertThat((Document) 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));
@@ -1699,10 +1597,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));
@@ -1736,10 +1631,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));
@@ -1888,9 +1780,7 @@ public class AggregationTests {
}
}
/**
* @see DATAMONGO-806
*/
// DATAMONGO-806
static class User {
@Id String id;
@@ -1904,9 +1794,7 @@ public class AggregationTests {
}
}
/**
* @see DATAMONGO-806
*/
// DATAMONGO-806
static class PushMessage {
@Id String id;
@@ -1996,9 +1884,7 @@ public class AggregationTests {
}
}
/**
* @see DATAMONGO-861
*/
// DATAMONGO-861
@org.springframework.data.mongodb.core.mapping.Document(collection = "inventory")
static class InventoryItem {
@@ -2025,9 +1911,7 @@ public class AggregationTests {
}
}
/**
* @see DATAMONGO-1491
*/
// DATAMONGO-1491
@lombok.Data
@Builder
static class Sales {
@@ -2036,9 +1920,7 @@ public class AggregationTests {
List<Item> items;
}
/**
* @see DATAMONGO-1491
*/
// DATAMONGO-1491
@lombok.Data
@Builder
static class Item {
@@ -2049,9 +1931,7 @@ public class AggregationTests {
Long price;
}
/**
* @see DATAMONGO-1538
*/
// DATAMONGO-1538
@lombok.Data
@Builder
static class Sales2 {
@@ -2062,9 +1942,7 @@ public class AggregationTests {
boolean applyDiscount;
}
/**
* @see DATAMONGO-1551
*/
// DATAMONGO-1551
@lombok.Data
@Builder
static class Employee {
@@ -2074,9 +1952,7 @@ public class AggregationTests {
String reportsTo;
}
/**
* @see DATAMONGO-1552
*/
// DATAMONGO-1552
@lombok.Data
@Builder
static class Art {

View File

@@ -67,10 +67,7 @@ public class AggregationUnitTests {
newAggregation(String.class, new AggregationOperation[0]);
}
/**
* @see DATAMONGO-753
*/
@Test
@Test // DATAMONGO-753
public void checkForCorrectFieldScopeTransfer() {
exception.expect(IllegalArgumentException.class);
@@ -84,10 +81,7 @@ public class AggregationUnitTests {
).toDocument("foo", Aggregation.DEFAULT_CONTEXT); // -> triggers IllegalArgumentException
}
/**
* @see DATAMONGO-753
*/
@Test
@Test // DATAMONGO-753
public void unwindOperationShouldNotChangeAvailableFields() {
newAggregation( //
@@ -97,10 +91,7 @@ public class AggregationUnitTests {
).toDocument("foo", Aggregation.DEFAULT_CONTEXT);
}
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void unwindOperationWithIndexShouldPreserveFields() {
newAggregation( //
@@ -110,10 +101,7 @@ public class AggregationUnitTests {
).toDocument("foo", Aggregation.DEFAULT_CONTEXT);
}
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void unwindOperationWithIndexShouldAddIndexField() {
newAggregation( //
@@ -123,10 +111,7 @@ public class AggregationUnitTests {
).toDocument("foo", Aggregation.DEFAULT_CONTEXT);
}
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void fullUnwindOperationShouldBuildCorrectClause() {
Document agg = newAggregation( //
@@ -140,10 +125,7 @@ public class AggregationUnitTests {
containing("preserveNullAndEmptyArrays", true));
}
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void unwindOperationWithPreserveNullShouldBuildCorrectClause() {
Document agg = newAggregation( //
@@ -155,10 +137,7 @@ public class AggregationUnitTests {
isBsonObject().notContaining("includeArrayIndex").containing("preserveNullAndEmptyArrays", true));
}
/**
* @see DATAMONGO-1550
*/
@Test
@Test // DATAMONGO-1550
public void replaceRootOperationShouldBuildCorrectClause() {
Document agg = newAggregation( //
@@ -170,10 +149,7 @@ public class AggregationUnitTests {
assertThat(unwind, isBsonObject().containing("$replaceRoot.newRoot", new Document("field", "value")));
}
/**
* @see DATAMONGO-753
*/
@Test
@Test // DATAMONGO-753
public void matchOperationShouldNotChangeAvailableFields() {
newAggregation( //
@@ -183,10 +159,7 @@ public class AggregationUnitTests {
).toDocument("foo", Aggregation.DEFAULT_CONTEXT);
}
/**
* @see DATAMONGO-788
*/
@Test
@Test // DATAMONGO-788
public void referencesToGroupIdsShouldBeRenderedAsReferences() {
Document agg = newAggregation( //
@@ -202,10 +175,7 @@ public class AggregationUnitTests {
assertThat(fields.get("a"), is((Object) "$_id.a"));
}
/**
* @see DATAMONGO-791
*/
@Test
@Test // DATAMONGO-791
public void allowAggregationOperationsToBePassedAsIterable() {
List<AggregationOperation> ops = new ArrayList<AggregationOperation>();
@@ -222,10 +192,7 @@ public class AggregationUnitTests {
assertThat(fields.get("a"), is((Object) "$_id.a"));
}
/**
* @see DATAMONGO-791
*/
@Test
@Test // DATAMONGO-791
public void allowTypedAggregationOperationsToBePassedAsIterable() {
List<AggregationOperation> ops = new ArrayList<AggregationOperation>();
@@ -242,10 +209,7 @@ public class AggregationUnitTests {
assertThat(fields.get("a"), is((Object) "$_id.a"));
}
/**
* @see DATAMONGO-838
*/
@Test
@Test // DATAMONGO-838
public void expressionBasedFieldsShouldBeReferencableInFollowingOperations() {
Document agg = newAggregation( //
@@ -259,10 +223,7 @@ public class AggregationUnitTests {
assertThat(fields.get("foosum"), is((Object) new Document("$sum", "$foo")));
}
/**
* @see DATAMONGO-908
*/
@Test
@Test // DATAMONGO-908
public void shouldSupportReferingToNestedPropertiesInGroupOperation() {
Document agg = newAggregation( //
@@ -280,10 +241,7 @@ public class AggregationUnitTests {
assertThat(id.get("ruleType"), is((Object) "$rules.ruleType"));
}
/**
* @see DATAMONGO-1585
*/
@Test
@Test // DATAMONGO-1585
public void shouldSupportSortingBySyntheticAndExposedGroupFields() {
Document agg = newAggregation( //
@@ -298,10 +256,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(sort, "$sort"), is(Document.parse("{ \"_id.cmsParameterId\" : 1 , \"titles\" : 1}")));
}
/**
* @see DATAMONGO-1585
*/
@Test
@Test // DATAMONGO-1585
public void shouldSupportSortingByProjectedFields() {
Document agg = newAggregation( //
@@ -321,10 +276,7 @@ public class AggregationUnitTests {
.containing("alias", 1));
}
/**
* @see DATAMONGO-924
*/
@Test
@Test // DATAMONGO-924
public void referencingProjectionAliasesFromPreviousStepShouldReferToTheSameFieldTarget() {
Document agg = newAggregation( //
@@ -339,10 +291,7 @@ public class AggregationUnitTests {
assertThat(projection1, is((Document) new Document("b", "$ba")));
}
/**
* @see DATAMONGO-960
*/
@Test
@Test // DATAMONGO-960
public void shouldRenderAggregationWithDefaultOptionsCorrectly() {
Document agg = newAggregation( //
@@ -353,10 +302,7 @@ public class AggregationUnitTests {
is(Document.parse("{ \"aggregate\" : \"foo\" , \"pipeline\" : [ { \"$project\" : { \"aa\" : \"$a\"}}]}")));
}
/**
* @see DATAMONGO-960
*/
@Test
@Test // DATAMONGO-960
public void shouldRenderAggregationWithCustomOptionsCorrectly() {
AggregationOptions aggregationOptions = newAggregationOptions().explain(true).cursor(new Document("foo", 1))
@@ -377,10 +323,7 @@ public class AggregationUnitTests {
));
}
/**
* @see DATAMONGO-954, DATAMONGO-1585
*/
@Test
@Test // DATAMONGO-954, DATAMONGO-1585
public void shouldSupportReferencingSystemVariables() {
Document agg = newAggregation( //
@@ -401,10 +344,7 @@ public class AggregationUnitTests {
assertThat(group, is((Document) new Document("_id", "$someKey").append("doc", new Document("$first", "$$ROOT"))));
}
/**
* @see DATAMONGO-1254
*/
@Test
@Test // DATAMONGO-1254
public void shouldExposeAliasedFieldnameForProjectionsIncludingOperationsDownThePipeline() {
Document agg = Aggregation.newAggregation(//
@@ -418,10 +358,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(group, "count"), is(new Document().append("$sum", "$tags_count")));
}
/**
* @see DATAMONGO-1254
*/
@Test
@Test // DATAMONGO-1254
public void shouldUseAliasedFieldnameForProjectionsIncludingOperationsDownThePipelineWhenUsingSpEL() {
Document agg = Aggregation.newAggregation(//
@@ -435,10 +372,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(group, "count"), is(new Document().append("$sum", "$tags_count")));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void conditionExpressionBasedFieldsShouldBeReferencableInFollowingOperations() {
Document agg = newAggregation( //
@@ -457,10 +391,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(fields, "foosum"), isBsonObject().containing("$first.$cond.else", "no-answer"));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void shouldRenderProjectionConditionalExpressionCorrectly() {
Document agg = Aggregation.newAggregation(//
@@ -479,10 +410,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(project, "color"), isBsonObject().containing("$cond", expectedCondition));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void shouldRenderProjectionConditionalCorrectly() {
Document agg = Aggregation.newAggregation(//
@@ -502,10 +430,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(project, "color"), isBsonObject().containing("$cond", expectedCondition));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void shouldRenderProjectionConditionalWithCriteriaCorrectly() {
Document agg = Aggregation
@@ -524,10 +449,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(project, "color"), isBsonObject().containing("$cond", expectedCondition));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void referencingProjectionAliasesShouldRenderProjectionConditionalWithFieldReferenceCorrectly() {
Document agg = Aggregation
@@ -549,10 +471,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(project, "luminosity"), isBsonObject().containing("$cond", expectedCondition));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void referencingProjectionAliasesShouldRenderProjectionConditionalWithCriteriaReferenceCorrectly() {
Document agg = Aggregation
@@ -574,10 +493,7 @@ public class AggregationUnitTests {
assertThat(getAsDocument(project, "luminosity"), isBsonObject().containing("$cond", expectedCondition));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void shouldRenderProjectionIfNullWithFieldReferenceCorrectly() {
Document agg = Aggregation
@@ -595,10 +511,7 @@ public class AggregationUnitTests {
isBsonObject().containing("$ifNull", Arrays.<Object> asList("$chroma", "unknown")));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void shouldRenderProjectionIfNullWithFallbackFieldReferenceCorrectly() {
Document agg = Aggregation
@@ -615,10 +528,7 @@ public class AggregationUnitTests {
isBsonObject().containing("$ifNull", Arrays.asList("$chroma", "$fallback")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldHonorDefaultCountField() {
Document agg = Aggregation
@@ -632,10 +542,7 @@ public class AggregationUnitTests {
assertThat(project, isBsonObject().containing("count", 1));
}
/**
* @see DATAMONGO-1533
*/
@Test
@Test // DATAMONGO-1533
public void groupOperationShouldAllowUsageOfDerivedSpELAggregationExpression() {
Document agg = newAggregation( //

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,26 +32,17 @@ import org.bson.Document;
*/
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) //
@@ -63,18 +54,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) //
@@ -84,10 +69,7 @@ public class BucketAutoOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ titles : { $sum: 1 } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderCorrectly() {
Document agg = bucketAuto("field", 1).withBuckets(5).toDocument(Aggregation.DEFAULT_CONTEXT);
@@ -95,10 +77,7 @@ public class BucketAutoOperationUnitTests {
assertThat(agg, is(Document.parse("{ $bucketAuto: { groupBy: \"$field\", buckets: 5 } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderGranulariy() {
Document agg = bucketAuto("field", 1) //
@@ -108,10 +87,7 @@ public class BucketAutoOperationUnitTests {
assertThat(agg, is(Document.parse("{ $bucketAuto: { buckets: 1, granularity: \"E24\", groupBy: \"$field\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderSumOperator() {
BucketAutoOperation operation = bucketAuto("field", 5) //
@@ -121,10 +97,7 @@ public class BucketAutoOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ cummulated_score : { $sum: \"$score\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderSumWithOwnOutputExpression() {
BucketAutoOperation operation = bucketAuto("field", 5) //

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,18 +31,12 @@ import org.bson.Document;
*/
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") //
@@ -54,18 +48,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") //
@@ -75,10 +63,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ titles : { $sum: 1 } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderSumAggregationExpression() {
Document agg = bucket("field") //
@@ -89,10 +74,7 @@ public class BucketOperationUnitTests {
"{ $bucket: { groupBy: \"$field\", boundaries: [], output : { quizTotal: { $sum: \"$quizzes\"} } } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderDefault() {
Document agg = bucket("field").withDefaultBucket("default bucket").toDocument(Aggregation.DEFAULT_CONTEXT);
@@ -101,10 +83,7 @@ public class BucketOperationUnitTests {
is(Document.parse("{ $bucket: { groupBy: \"$field\", boundaries: [], default: \"default bucket\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderBoundaries() {
Document agg = bucket("field") //
@@ -116,10 +95,7 @@ public class BucketOperationUnitTests {
is(Document.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") //
@@ -129,10 +105,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ cummulated_score : { $sum: \"$score\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderSumWithValueOperator() {
BucketOperation operation = bucket("field") //
@@ -142,10 +115,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ cummulated_score : { $sum: 4 } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderAvgOperator() {
BucketOperation operation = bucket("field") //
@@ -155,10 +125,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ average : { $avg: \"$score\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderFirstOperator() {
BucketOperation operation = bucket("field") //
@@ -168,10 +135,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ first_title : { $first: \"$title\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderLastOperator() {
BucketOperation operation = bucket("field") //
@@ -181,10 +145,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ last_title : { $last: \"$title\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderMinOperator() {
BucketOperation operation = bucket("field") //
@@ -194,10 +155,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ min_score : { $min: \"$score\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderPushOperator() {
BucketOperation operation = bucket("field") //
@@ -207,10 +165,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ titles : { $push: \"$title\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderAddToSetOperator() {
BucketOperation operation = bucket("field") //
@@ -220,10 +175,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ titles : { $addToSet: \"$title\" } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderSumWithExpression() {
BucketOperation operation = bucket("field") //
@@ -233,10 +185,7 @@ public class BucketOperationUnitTests {
assertThat(extractOutput(agg), is(Document.parse("{ total : { $sum: { $add : [\"$netPrice\", \"$tax\"]} } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderSumWithOwnOutputExpression() {
BucketOperation operation = bucket("field") //
@@ -247,10 +196,7 @@ public class BucketOperationUnitTests {
is(Document.parse("{ total : { $multiply: [ {$add : [\"$netPrice\", \"$tax\"]}, 5] } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldExposeDefaultCountField() {
BucketOperation operation = bucket("field");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,42 +34,27 @@ import org.springframework.data.mongodb.core.query.Criteria;
*/
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((Document) 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");
@@ -83,10 +68,7 @@ public class CondExpressionUnitTests {
assertThat(document, 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")
@@ -101,10 +83,7 @@ public class CondExpressionUnitTests {
assertThat(document, isBsonObject().containing("$cond", expectedCondition));
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void andCriteriaShouldRenderCorrectly() {
Cond operator = ConditionalOperators.when(Criteria.where("luminosity").gte(100) //
@@ -126,10 +105,7 @@ public class CondExpressionUnitTests {
assertThat(document, 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) //
@@ -149,10 +125,7 @@ public class CondExpressionUnitTests {
assertThat(document, 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)) //

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,28 +28,19 @@ import org.junit.Test;
*/
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.toDocument(Aggregation.DEFAULT_CONTEXT), is(Document.parse("{$count : \"field\" }")));
}
/**
* @see DATAMONGO-1549
*/
@Test
@Test // DATAMONGO-1549
public void countExposesFields() {
CountOperation countOperation = new CountOperation("field");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,10 +32,7 @@ import org.bson.Document;
*/
public class FacetOperationUnitTests {
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldRenderCorrectly() throws Exception {
FacetOperation facetOperation = new FacetOperation()
@@ -57,10 +54,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();
@@ -70,10 +64,7 @@ public class FacetOperationUnitTests {
assertThat(agg, is(Document.parse("{ $facet: { } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1552
public void shouldRejectNonExistingFields() throws Exception {
FacetOperation facetOperation = new FacetOperation()
@@ -94,10 +85,7 @@ public class FacetOperationUnitTests {
+ "categorizedByYears: [ { $bucketAuto: { buckets: 5, groupBy: \"$year\" } } ] } }")));
}
/**
* @see DATAMONGO-1552
*/
@Test
@Test // DATAMONGO-1552
public void shouldHonorProjectedFields() {
FacetOperation facetOperation = new FacetOperation()

View File

@@ -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"));

View File

@@ -54,10 +54,7 @@ public class FilterExpressionUnitTests {
new QueryMapper(new MappingMongoConverter(new DefaultDbRefResolver(mongoDbFactory), mappingContext)));
}
/**
* @see DATAMONGO-1491
*/
@Test
@Test // DATAMONGO-1491
public void shouldConstructFilterExpressionCorrectly() {
TypedAggregation<Sales> agg = Aggregation.newAggregation(Sales.class,
@@ -81,10 +78,7 @@ public class FilterExpressionUnitTests {
assertThat($filter, is(new Document(expected)));
}
/**
* @see DATAMONGO-1491
*/
@Test
@Test // DATAMONGO-1491
public void shouldConstructFilterExpressionCorrectlyWhenUsingFilterOnProjectionBuilder() {
TypedAggregation<Sales> agg = Aggregation.newAggregation(Sales.class, Aggregation.project().and("items")
@@ -106,10 +100,7 @@ public class FilterExpressionUnitTests {
assertThat($filter, is(expected));
}
/**
* @see DATAMONGO-1491
*/
@Test
@Test // DATAMONGO-1491
public void shouldConstructFilterExpressionCorrectlyWhenInputMapToArray() {
TypedAggregation<Sales> agg = Aggregation.newAggregation(Sales.class,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,10 +31,7 @@ import org.springframework.data.mongodb.core.query.NearQuery;
*/
public class GeoNearOperationUnitTests {
/**
* @see DATAMONGO-1127
*/
@Test
@Test // DATAMONGO-1127
public void rendersNearQueryAsAggregationOperation() {
NearQuery query = NearQuery.near(10.0, 10.0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,18 +36,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() //
@@ -64,10 +58,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() //
@@ -83,10 +74,7 @@ public class GraphLookupOperationUnitTests {
isBsonObject().containing("$graphLookup.restrictSearchWithMatch", new Document("key", "value")));
}
/**
* @see DATAMONGO-1551
*/
@Test
@Test // DATAMONGO-1551
public void shouldRenderArrayOfStartsWithCorrectly() {
GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() //
@@ -103,10 +91,7 @@ public class GraphLookupOperationUnitTests {
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
}
/**
* @see DATAMONGO-1551
*/
@Test
@Test // DATAMONGO-1551
public void shouldRenderMixedArrayOfStartsWithCorrectly() {
GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() //
@@ -123,10 +108,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() //
@@ -137,10 +119,7 @@ public class GraphLookupOperationUnitTests {
.as("reportingHierarchy");
}
/**
* @see DATAMONGO-1551
*/
@Test
@Test // DATAMONGO-1551
public void shouldRenderStartWithAggregationExpressions() {
GraphLookupOperation graphLookupOperation = GraphLookupOperation.builder() //

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,10 +40,7 @@ public class GroupOperationUnitTests {
new GroupOperation((Fields) null);
}
/**
* @see DATAMONGO-759
*/
@Test
@Test // DATAMONGO-759
public void groupOperationWithNoGroupIdFieldsShouldGenerateNullAsGroupId() {
GroupOperation operation = new GroupOperation(Fields.from());
@@ -55,10 +52,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");
@@ -186,10 +180,7 @@ public class GroupOperationUnitTests {
assertThat(push, is((Document) new Document("$addToSet", 42)));
}
/**
* @see DATAMONGO-979
*/
@Test
@Test // DATAMONGO-979
public void shouldRenderSizeExpressionInGroup() {
GroupOperation groupOperation = Aggregation //
@@ -203,10 +194,7 @@ public class GroupOperationUnitTests {
assertThat(tagsCount.get("$first"), is((Object) new Document("$size", Arrays.asList("$tags"))));
}
/**
* @see DATAMONGO-1327
*/
@Test
@Test // DATAMONGO-1327
public void groupOperationStdDevSampWithValue() {
GroupOperation groupOperation = Aggregation.group("a", "b").stdDevSamp("field").as("fieldStdDevSamp");
@@ -217,10 +205,7 @@ public class GroupOperationUnitTests {
assertThat(push, is(new Document("$stdDevSamp", "$field")));
}
/**
* @see DATAMONGO-1327
*/
@Test
@Test // DATAMONGO-1327
public void groupOperationStdDevPopWithValue() {
GroupOperation groupOperation = Aggregation.group("a", "b").stdDevPop("field").as("fieldStdDevPop");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,42 +32,27 @@ import org.springframework.data.mongodb.core.DocumentTestUtils;
*/
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");
@@ -81,10 +66,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");
@@ -101,42 +83,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");
@@ -150,10 +117,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");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,26 +29,17 @@ import org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation.Re
*/
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()
@@ -58,10 +49,7 @@ public class ReplaceRootOperationUnitTests {
assertThat(dbObject, is(Document.parse("{ $replaceRoot : { newRoot: { hello: \"world\" } } }")));
}
/**
* @see DATAMONGO-1550
*/
@Test
@Test // DATAMONGO-1550
public void shouldRenderExpressionCorrectly() {
ReplaceRootOperation operation = new ReplaceRootOperation(VariableOperators //
@@ -75,10 +63,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() //
@@ -91,10 +76,7 @@ public class ReplaceRootOperationUnitTests {
.parse("{ $replaceRoot : { newRoot: { key: \"value\", multiply: { $multiply : [ \"$$element\" , 10]} } } }")));
}
/**
* @see DATAMONGO-1550
*/
@Test
@Test // DATAMONGO-1550
public void shouldComposeSubDocument() {
Document partialReplacement = new Document("key", "override").append("key2", "value2");
@@ -108,10 +90,7 @@ public class ReplaceRootOperationUnitTests {
assertThat(dbObject, is(Document.parse("{ $replaceRoot : { newRoot: { key: \"override\", key2: \"value2\"} } } }")));
}
/**
* @see DATAMONGO-1550
*/
@Test
@Test // DATAMONGO-1550
public void shouldNotExposeFields() {
ReplaceRootOperation operation = new ReplaceRootOperation(Fields.field("field"));

View File

@@ -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);

View File

@@ -82,10 +82,7 @@ public class TypeBasedAggregationOperationContextUnitTests {
getContext(Foo.class).getReference("foo");
}
/**
* @see DATAMONGO-741
*/
@Test
@Test // DATAMONGO-741
public void returnsReferencesToNestedFieldsCorrectly() {
AggregationOperationContext context = getContext(Foo.class);
@@ -97,10 +94,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);
@@ -108,10 +102,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();
@@ -130,10 +121,7 @@ public class TypeBasedAggregationOperationContextUnitTests {
assertThat(age, is(new org.bson.Document("v", 10)));
}
/**
* @see DATAMONGO-912
*/
@Test
@Test // DATAMONGO-912
public void shouldUseCustomConversionIfPresentAndConversionIsRequiredInLaterStage() {
CustomConversions customConversions = customAgeConversions();
@@ -152,10 +140,7 @@ public class TypeBasedAggregationOperationContextUnitTests {
assertThat(age, is(new org.bson.Document("v", 10)));
}
/**
* @see DATAMONGO-960
*/
@Test
@Test // DATAMONGO-960
public void rendersAggregationOptionsInTypedAggregationContextCorrectly() {
AggregationOperationContext context = getContext(FooPerson.class);
@@ -175,10 +160,7 @@ public class TypeBasedAggregationOperationContextUnitTests {
assertThat(document.get("cursor"), is((Object) new org.bson.Document("foo", 1)));
}
/**
* @see DATAMONGO-1585
*/
@Test
@Test // DATAMONGO-1585
public void rendersSortOfProjectedFieldCorrectly() {
TypeBasedAggregationOperationContext context = getContext(MeterData.class);
@@ -192,10 +174,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);
@@ -213,10 +192,7 @@ public class TypeBasedAggregationOperationContextUnitTests {
.containing("age", "$age.value"));
}
/**
* @see DATAMONGO-1133
*/
@Test
@Test // DATAMONGO-1133
public void shouldHonorAliasedFieldsInGroupExpressions() {
TypeBasedAggregationOperationContext context = getContext(MeterData.class);
@@ -231,10 +207,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);
@@ -251,10 +224,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);
@@ -269,10 +239,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);
@@ -289,10 +256,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);
@@ -309,10 +273,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);
@@ -323,10 +284,7 @@ public class TypeBasedAggregationOperationContextUnitTests {
agg.toDocument("meterData", context);
}
/**
* @see DATAMONGO-861
*/
@Test
@Test // DATAMONGO-861
public void rendersAggregationConditionalInTypedAggregationContextCorrectly() {
AggregationOperationContext context = getContext(FooPerson.class);
@@ -352,10 +310,8 @@ public class TypeBasedAggregationOperationContextUnitTests {
/**
* .AggregationUnitTests
*
* @see DATAMONGO-861, DATAMONGO-1542
*/
@Test
@Test // DATAMONGO-861, DATAMONGO-1542
public void rendersAggregationIfNullInTypedAggregationContextCorrectly() {
AggregationOperationContext context = getContext(FooPerson.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,10 +31,7 @@ import org.springframework.data.mongodb.core.DocumentTestUtils;
*/
public class UnwindOperationUnitTests {
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void unwindWithPathOnlyShouldUsePreMongo32Syntax() {
UnwindOperation unwindOperation = Aggregation.unwind("a");
@@ -44,10 +41,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");
@@ -60,10 +54,7 @@ public class UnwindOperationUnitTests {
containing("includeArrayIndex", "index"));
}
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void unwindWithArrayIndexShouldExposeArrayIndex() {
UnwindOperation unwindOperation = Aggregation.unwind("a", "index");
@@ -71,10 +62,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");
@@ -82,10 +70,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);
@@ -98,10 +83,7 @@ public class UnwindOperationUnitTests {
notContaining("includeArrayIndex"));
}
/**
* @see DATAMONGO-1391
*/
@Test
@Test // DATAMONGO-1391
public void lookupBuilderBuildsCorrectClause() {
UnwindOperation unwindOperation = UnwindOperation.newUnwind().path("$foo").noArrayIndex().skipNullAndEmptyArrays();
@@ -110,10 +92,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")

View File

@@ -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 <a href="http://docs.mongodb.org/manual/tutorial/aggregation-examples/">Aggregation Examples</a>
* @see <a href="http://media.mongodb.org/zips.json>zips.json</a>
*/
class ZipInfo {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,10 +37,7 @@ import com.mongodb.DBRef;
*/
public class AbstractMongoConverterUnitTests {
/**
* @see DATAMONGO-1324
*/
@Test
@Test // DATAMONGO-1324
public void registersObjectIdConvertersExplicitly() {
DefaultConversionService conversionService = spy(new DefaultConversionService());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,10 +82,7 @@ public class CustomConversionsUnitTests {
assertThat(conversions.isSimpleType(UUID.class), is(true));
}
/**
* @see DATAMONGO-240
*/
@Test
@Test // DATAMONGO-240
public void considersObjectIdToBeSimpleType() {
CustomConversions conversions = new CustomConversions();
@@ -94,10 +91,7 @@ public class CustomConversionsUnitTests {
}
/**
* @see DATAMONGO-240
*/
@Test
@Test // DATAMONGO-240
public void considersCustomConverterForSimpleType() {
CustomConversions conversions = new CustomConversions(Arrays.asList(new Converter<ObjectId, String>() {
@@ -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();

View File

@@ -39,7 +39,6 @@ import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
* 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 {
@@ -74,7 +73,7 @@ public class CustomConvertersUnitTests {
converter.afterPropertiesSet();
}
@Test
@Test // DATADOC-101
public void nestedToDocumentConverterGetsInvoked() {
Foo foo = new Foo();
@@ -84,7 +83,7 @@ public class CustomConvertersUnitTests {
verify(barToDocumentConverter).convert(any(Bar.class));
}
@Test
@Test // DATADOC-101
public void nestedFromDocumentConverterGetsInvoked() {
Document document = new Document();
@@ -94,21 +93,21 @@ public class CustomConvertersUnitTests {
verify(documentToBarConverter).convert(any(Document.class));
}
@Test
@Test // DATADOC-101
public void toDocumentConverterGetsInvoked() {
converter.write(new Bar(), new Document());
verify(barToDocumentConverter).convert(any(Bar.class));
}
@Test
@Test // DATADOC-101
public void fromDocumentConverterGetsInvoked() {
converter.read(Bar.class, new Document());
verify(documentToBarConverter).convert(any(Document.class));
}
@Test
@Test // DATADOC-101
public void foo() {
Document document = new Document();
document.put("foo", null);

View File

@@ -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.
@@ -49,10 +49,7 @@ public class DataMongo273Tests {
converter.afterPropertiesSet();
}
/**
* @see DATAMONGO-273
*/
@Test
@Test // DATAMONGO-273
public void convertMapOfThings() {
Plane plane = new Plane("Boeing", 4);
@@ -75,10 +72,7 @@ public class DataMongo273Tests {
assertTrue(mapOfThings2.get("automobile") instanceof Automobile);
}
/**
* @see DATAMONGO-294
*/
@Test
@Test // DATAMONGO-294
@Ignore("TODO: Mongo3 - this is no longer supported as DBList is no Bson type :/")
@SuppressWarnings({ "rawtypes", "unchecked" })
public void convertListOfThings() {
@@ -101,10 +95,7 @@ public class DataMongo273Tests {
assertTrue(listOfThings2.get(2) instanceof Automobile);
}
/**
* @see DATAMONGO-294
*/
@Test
@Test // DATAMONGO-294
@SuppressWarnings({ "rawtypes", "unchecked" })
public void convertListOfThings_NestedInMap() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,10 +89,7 @@ public class DbRefMappingMongoConverterUnitTests {
this.converter = new MappingMongoConverter(dbRefResolver, mappingContext);
}
/**
* @see DATAMONGO-347
*/
@Test
@Test // DATAMONGO-347
public void createsSimpleDBRefCorrectly() {
Person person = new Person();
@@ -103,10 +100,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(dbRef.getCollectionName(), is("person"));
}
/**
* @see DATAMONGO-657
*/
@Test
@Test // DATAMONGO-657
public void convertDocumentWithMapDBRef() {
Document mapValDocument = new Document();
@@ -151,10 +145,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);
@@ -168,10 +159,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(dbRef.getCollectionName(), is("person"));
}
/**
* @see DATAMONGO-348
*/
@Test
@Test // DATAMONGO-348
public void lazyLoadingProxyForLazyDbRefOnInterface() {
String id = "42";
@@ -192,10 +180,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";
@@ -217,10 +202,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";
@@ -241,10 +223,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(result.dbRefToConcreteType.getValue(), is(value));
}
/**
* @see DATAMONGO-348
*/
@Test
@Test // DATAMONGO-348
public void lazyLoadingProxyForLazyDbRefOnConcreteTypeWithPersistenceConstructor() {
String id = "42";
@@ -266,10 +245,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(result.dbRefToConcreteTypeWithPersistenceConstructor.getValue(), is(value));
}
/**
* @see DATAMONGO-348
*/
@Test
@Test // DATAMONGO-348
public void lazyLoadingProxyForLazyDbRefOnConcreteTypeWithPersistenceConstructorButWithoutDefaultConstructor() {
String id = "42";
@@ -291,10 +267,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(result.dbRefToConcreteTypeWithPersistenceConstructorWithoutDefaultConstructor.getValue(), is(value));
}
/**
* @see DATAMONGO-348
*/
@Test
@Test // DATAMONGO-348
public void lazyLoadingProxyForSerializableLazyDbRefOnConcreteType() {
String id = "42";
@@ -316,10 +289,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(deserializedResult.dbRefToSerializableTarget.getValue(), is(value));
}
/**
* @see DATAMONGO-884
*/
@Test
@Test // DATAMONGO-884
public void lazyLoadingProxyForToStringObjectMethodOverridingDbref() {
String id = "42";
@@ -340,10 +310,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefToToStringObjectMethodOverride, true);
}
/**
* @see DATAMONGO-884
*/
@Test
@Test // DATAMONGO-884
public void callingToStringObjectMethodOnLazyLoadingDbrefShouldNotInitializeProxy() {
String id = "42";
@@ -371,10 +338,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefToPlainObject, true);
}
/**
* @see DATAMONGO-884
*/
@Test
@Test // DATAMONGO-884
public void equalsObjectMethodOnLazyLoadingDbrefShouldNotInitializeProxy() {
String id = "42";
@@ -400,10 +364,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefToPlainObject, false);
}
/**
* @see DATAMONGO-884
*/
@Test
@Test // DATAMONGO-884
public void hashcodeObjectMethodOnLazyLoadingDbrefShouldNotInitializeProxy() {
String id = "42";
@@ -427,10 +388,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefToPlainObject, false);
}
/**
* @see DATAMONGO-884
*/
@Test
@Test // DATAMONGO-884
public void lazyLoadingProxyForEqualsAndHashcodeObjectMethodOverridingDbref() {
String id = "42";
@@ -459,10 +417,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefEqualsAndHashcodeObjectMethodOverride2, true);
}
/**
* @see DATAMONGO-987
*/
@Test
@Test // DATAMONGO-987
public void shouldNotGenerateLazyLoadingProxyForNullValues() {
Document document = new Document();
@@ -480,10 +435,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(result.dbRefToConcreteTypeWithPersistenceConstructorWithoutDefaultConstructor, is(nullValue()));
}
/**
* @see DATAMONGO-1005
*/
@Test
@Test // DATAMONGO-1005
public void shouldBeAbleToStoreDirectReferencesToSelf() {
Document document = new Document();
@@ -499,10 +451,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertThat(found.reference, is(found));
}
/**
* @see DATAMONGO-1005
*/
@Test
@Test // DATAMONGO-1005
public void shouldBeAbleToStoreNestedReferencesToSelf() {
Document document = new Document();
@@ -521,10 +470,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);
@@ -545,10 +491,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefToConcreteType, false);
}
/**
* @see DATAMONGO-1012
*/
@Test
@Test // DATAMONGO-1012
public void shouldNotEagerlyResolveIdPropertyWithPropertyAccess() {
MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(ClassWithLazyDbRefs.class);
@@ -566,10 +509,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);
@@ -586,10 +526,7 @@ public class DbRefMappingMongoConverterUnitTests {
assertProxyIsResolved(result.dbRefToPlainObject, false);
}
/**
* @see DATAMONGO-1194
*/
@Test
@Test // DATAMONGO-1194
public void shouldBulkFetchListOfReferences() {
String id1 = "1";
@@ -616,10 +553,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";
@@ -648,10 +582,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();
@@ -683,10 +614,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();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,10 +70,7 @@ public class DefaultDbRefResolverUnitTests {
resolver = new DefaultDbRefResolver(factoryMock);
}
/**
* @see DATAMONGO-1194
*/
@Test
@Test // DATAMONGO-1194
@SuppressWarnings("unchecked")
public void bulkFetchShouldLoadDbRefsCorrectly() {
@@ -92,10 +89,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());
@@ -104,10 +98,7 @@ public class DefaultDbRefResolverUnitTests {
resolver.bulkFetch(Arrays.asList(ref1, ref2));
}
/**
* @see DATAMONGO-1194
*/
@Test
@Test // DATAMONGO-1194
public void bulkFetchShouldReturnEarlyForEmptyLists() {
resolver.bulkFetch(Collections.<DBRef>emptyList());
@@ -115,10 +106,7 @@ public class DefaultDbRefResolverUnitTests {
verify(collectionMock, never()).find(Mockito.any(Document.class));
}
/**
* @see DATAMONGO-1194
*/
@Test
@Test // DATAMONGO-1194
public void bulkFetchShouldRestoreOriginalOrder() {
Document o1 = new Document("_id", new ObjectId());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -105,10 +105,7 @@ public class DefaultMongoTypeMapperUnitTests {
readsTypeFromField(new Document(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY, Object.class.getName()), Object.class);
}
/**
* @see DATAMONGO-709
*/
@Test
@Test // DATAMONGO-709
public void writesTypeRestrictionsCorrectly() {
Document result = new Document();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@ import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
/**
* Unit tests for {@link DocumentAccessor}.
*
* @see DATAMONGO-766
* @author Oliver Gierke
*/
public class DocumentAccessorUnitTests {
@@ -40,7 +39,7 @@ public class DocumentAccessorUnitTests {
MongoPersistentEntity<?> projectingTypeEntity = context.getPersistentEntity(ProjectingType.class);
MongoPersistentProperty fooProperty = projectingTypeEntity.getPersistentProperty("foo");
@Test
@Test // DATAMONGO-766
public void putsNestedFieldCorrectly() {
Document document = new Document();
@@ -52,7 +51,7 @@ public class DocumentAccessorUnitTests {
assertThat(aDocument.get("b"), is((Object) "FooBar"));
}
@Test
@Test // DATAMONGO-766
public void getsNestedFieldCorrectly() {
Document source = new Document("a", new Document("b", "FooBar"));
@@ -61,27 +60,24 @@ public class DocumentAccessorUnitTests {
assertThat(accessor.get(fooProperty), is((Object) "FooBar"));
}
@Test
@Test // DATAMONGO-766
public void returnsNullForNonExistingFieldPath() {
DocumentAccessor accessor = new DocumentAccessor(new Document());
assertThat(accessor.get(fooProperty), is(nullValue()));
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAMONGO-766
public void rejectsNonDocuments() {
new DocumentAccessor(new BsonDocument());
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAMONGO-766
public void rejectsNullDocument() {
new DocumentAccessor(null);
}
/**
* @see DATAMONGO-1335
*/
@Test
@Test // DATAMONGO-1335
public void writesAllNestingsCorrectly() {
MongoPersistentEntity<?> entity = context.getPersistentEntity(TypeWithTwoNestings.class);
@@ -100,10 +96,7 @@ public class DocumentAccessorUnitTests {
assertThat(nestedA.get("c"), is((Object) "c"));
}
/**
* @see DATAMONGO-1471
*/
@Test
@Test // DATAMONGO-1471
public void exposesAvailabilityOfFields() {
DocumentAccessor accessor = new DocumentAccessor(new Document("a", new BasicDBObject("c", "d")));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,10 +52,7 @@ import org.springframework.data.mongodb.core.query.GeoCommand;
*/
public class GeoConvertersUnitTests {
/**
* @see DATAMONGO-858
*/
@Test
@Test // DATAMONGO-858
public void convertsBoxToDocumentAndBackCorrectly() {
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 convertsCircleToDocumentAndBackCorrectlyNeutralDistance() {
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 convertsCircleToDocumentAndBackCorrectlyMilesDistance() {
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 convertsPolygonToDocumentAndBackCorrectly() {
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 convertsSphereToDocumentAndBackCorrectlyWithNeutralDistance() {
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 convertsSphereToDocumentAndBackCorrectlyWithKilometerDistance() {
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 convertsGeoCommandToDocumentCorrectly() {
Box box = new Box(new double[] { 1, 2 }, new double[] { 3, 4 });

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -179,26 +179,17 @@ public class GeoJsonConverterUnitTests {
DocumentToGeoJsonPolygonConverter converter = DocumentToGeoJsonPolygonConverter.INSTANCE;
public @Rule ExpectedException expectedException = ExpectedException.none();
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertDboCorrectly() {
assertThat(converter.convert(POLYGON_DOC), 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);
@@ -207,10 +198,7 @@ public class GeoJsonConverterUnitTests {
converter.convert(new Document("type", "YouDontKonwMe"));
}
/**
* @see DATAMONGO-1399
*/
@Test
@Test // DATAMONGO-1399
public void shouldConvertDboWithMultipleRingsCorrectly() {
assertThat(converter.convert(POLYGON_WITH_2_RINGS_DOC), equalTo(POLYGON_WITH_2_RINGS));
}
@@ -225,26 +213,17 @@ public class GeoJsonConverterUnitTests {
DocumentToGeoJsonPointConverter converter = DocumentToGeoJsonPointConverter.INSTANCE;
public @Rule ExpectedException expectedException = ExpectedException.none();
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertDboCorrectly() {
assertThat(converter.convert(SINGLE_POINT_DOC), 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);
@@ -262,26 +241,17 @@ public class GeoJsonConverterUnitTests {
DocumentToGeoJsonLineStringConverter converter = DocumentToGeoJsonLineStringConverter.INSTANCE;
public @Rule ExpectedException expectedException = ExpectedException.none();
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertDboCorrectly() {
assertThat(converter.convert(LINE_STRING_DOC), 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);
@@ -299,26 +269,17 @@ public class GeoJsonConverterUnitTests {
DocumentToGeoJsonMultiLineStringConverter converter = DocumentToGeoJsonMultiLineStringConverter.INSTANCE;
public @Rule ExpectedException expectedException = ExpectedException.none();
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertDboCorrectly() {
assertThat(converter.convert(MULTI_LINE_STRING_DOC), 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);
@@ -336,26 +297,17 @@ public class GeoJsonConverterUnitTests {
DocumentToGeoJsonMultiPointConverter converter = DocumentToGeoJsonMultiPointConverter.INSTANCE;
public @Rule ExpectedException expectedException = ExpectedException.none();
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertDboCorrectly() {
assertThat(converter.convert(MULTI_POINT_DOC), 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);
@@ -373,26 +325,17 @@ public class GeoJsonConverterUnitTests {
DocumentToGeoJsonMultiPolygonConverter converter = DocumentToGeoJsonMultiPolygonConverter.INSTANCE;
public @Rule ExpectedException expectedException = ExpectedException.none();
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertDboCorrectly() {
assertThat(converter.convert(MULTI_POLYGON_DOC), 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);
@@ -409,73 +352,47 @@ public class GeoJsonConverterUnitTests {
GeoJsonToDocumentConverter converter = GeoJsonToDocumentConverter.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_DOC));
}
/**
* @see DATAMONGO-1135
*/
@Test
@Test // DATAMONGO-1135
public void shouldConvertGeoJsonPolygonCorrectly() {
assertThat(converter.convert(POLYGON), equalTo(POLYGON_DOC));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertGeoJsonLineStringCorrectly() {
assertThat(converter.convert(LINE_STRING), equalTo(LINE_STRING_DOC));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertGeoJsonMultiLineStringCorrectly() {
assertThat(converter.convert(MULTI_LINE_STRING), equalTo(MULTI_LINE_STRING_DOC));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertGeoJsonMultiPointCorrectly() {
assertThat(converter.convert(MULTI_POINT), equalTo(MULTI_POINT_DOC));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertGeoJsonMultiPolygonCorrectly() {
assertThat(converter.convert(MULTI_POLYGON), equalTo(MULTI_POLYGON_DOC));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouldConvertGeometryCollectionCorrectly() {
assertThat(converter.convert(GEOMETRY_COLLECTION), equalTo(GEOMETRY_COLLECTION_DOC));
}
/**
* @see DATAMONGO-1399
*/
@Test
@Test // DATAMONGO-1399
public void shouldConvertGeoJsonPolygonWithMultipleRingsCorrectly() {
assertThat(converter.convert(POLYGON_WITH_2_RINGS), equalTo(POLYGON_WITH_2_RINGS_DOC));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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.");

View File

@@ -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 convertsBoxToDocumentAndBackCorrectly() {
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 convertsCircleToDocumentAndBackCorrectly() {
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 convertsPolygonToDocumentAndBackCorrectly() {
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 convertsSphereToDocumentAndBackCorrectly() {
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)));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,10 +72,7 @@ public class MongoExampleMapperUnitTests {
this.mapper = new MongoExampleMapper(converter);
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedCorrectlyForFlatTypeWhenIdIsSet() {
FlatDocument probe = new FlatDocument();
@@ -86,10 +83,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();
@@ -105,10 +99,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();
@@ -122,10 +113,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();
@@ -139,10 +127,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();
@@ -153,10 +138,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();
@@ -170,10 +152,7 @@ public class MongoExampleMapperUnitTests {
isBsonObject().containing("_class", new org.bson.Document("$in", new String[] { probe.getClass().getName() })));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedAsFlatMapWhenGivenNestedElementsWithLenientMatchMode() {
WrapperDocument probe = new WrapperDocument();
@@ -185,10 +164,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();
@@ -201,10 +177,7 @@ public class MongoExampleMapperUnitTests {
isBsonObject().containing("flatDoc.stringValue", "conflux"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedCorrectlyForFlatTypeWhenStringMatchModeIsStarting() {
FlatDocument probe = new FlatDocument();
@@ -220,10 +193,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();
@@ -239,10 +209,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();
@@ -258,10 +225,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();
@@ -277,10 +241,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();
@@ -296,10 +257,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();
@@ -315,10 +273,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();
@@ -333,10 +288,7 @@ public class MongoExampleMapperUnitTests {
assertThat(reference.getCollectionName(), is("refDoc"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedWhenDBRefIsNull() {
FlatDocument probe = new FlatDocument();
@@ -347,10 +299,7 @@ public class MongoExampleMapperUnitTests {
assertThat(document, isBsonObject().containing("stringValue", "steelheart"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedCorrectlyWhenContainingLegacyPoint() {
ClassWithGeoTypes probe = new ClassWithGeoTypes();
@@ -362,10 +311,7 @@ public class MongoExampleMapperUnitTests {
assertThat(document.get("legacyPoint.y"), Is.<Object>is(20D));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void mappingShouldExcludeFieldWithCustomNameCorrectly() {
FlatDocument probe = new FlatDocument();
@@ -382,10 +328,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();
@@ -402,10 +345,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();
@@ -423,10 +363,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();
@@ -444,10 +381,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();
@@ -463,10 +397,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();
@@ -479,10 +410,7 @@ public class MongoExampleMapperUnitTests {
assertThat(document, isBsonObject().containing("anotherStringValue", "calamity"));
}
/**
* @see DATAMONGO-1459
*/
@Test
@Test // DATAMONGO-1459
public void mapsAnyMatchingExampleCorrectly() {
FlatDocument probe = new FlatDocument();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,18 +55,12 @@ public class NamedMongoScriptConvertsUnitTests {
NamedMongoScriptToDocumentConverter converter = NamedMongoScriptToDocumentConverter.INSTANCE;
/**
* @see DATAMONGO-479
*/
@Test
@Test // DATAMONGO-479
public void convertShouldReturnEmptyDocWhenScriptIsNull() {
assertThat(converter.convert(null), is((Document) new Document()));
}
/**
* @see DATAMONGO-479
*/
@Test
@Test // DATAMONGO-479
public void convertShouldConvertScriptNameCorreclty() {
Document document = converter.convert(ECHO_SCRIPT);
@@ -76,10 +70,7 @@ public class NamedMongoScriptConvertsUnitTests {
assertThat(id, is((Object) FUNCTION_NAME));
}
/**
* @see DATAMONGO-479
*/
@Test
@Test // DATAMONGO-479
public void convertShouldConvertScriptCodeCorreclty() {
Document document = converter.convert(ECHO_SCRIPT);
@@ -97,18 +88,12 @@ public class NamedMongoScriptConvertsUnitTests {
DocumentToNamedMongoScriptConverter converter = DocumentToNamedMongoScriptConverter.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);
@@ -116,10 +101,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);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,10 +52,7 @@ public class NumberToNumberConverterFactoryUnitTests {
return Arrays.<Number[]> 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));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -126,10 +126,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());
@@ -142,10 +139,7 @@ public class QueryMapperUnitTests {
assertThat(document.get("$ne"), is(instanceOf(ObjectId.class)));
}
/**
* @see DATAMONGO-326
*/
@Test
@Test // DATAMONGO-326
public void handlesEnumsCorrectly() {
Query query = query(where("foo").is(Enum.INSTANCE));
org.bson.Document result = mapper.getMappedObject(query.getQueryObject(), null);
@@ -185,20 +179,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(new org.bson.Document(query.toMap()), null);
}
/**
* @see DATAMONGO-369
*/
@Test
@Test // DATAMONGO-369
public void handlesAllPropertiesIfDocument() {
org.bson.Document query = new org.bson.Document();
@@ -209,10 +197,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']}}");
@@ -234,10 +219,7 @@ public class QueryMapperUnitTests {
assertThat(((org.bson.Document) 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")));
@@ -359,10 +338,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));
@@ -372,10 +348,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();
@@ -388,10 +361,7 @@ public class QueryMapperUnitTests {
assertThat(object.containsKey("_id"), is(false));
}
/**
* @see DATAMONGO-677
*/
@Test
@Test // DATAMONGO-677
public void handleMapWithDBRefCorrectly() {
org.bson.Document mapDocument = new org.bson.Document();
@@ -417,10 +387,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));
@@ -433,10 +400,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();
@@ -457,10 +421,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"));
@@ -471,10 +432,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"));
@@ -485,10 +443,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"));
@@ -502,10 +457,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);
@@ -519,10 +471,7 @@ public class QueryMapperUnitTests {
assertThat(idValuesAfter, is(idValuesBefore));
}
/**
* @see DATAMONGO-821
*/
@Test
@Test // DATAMONGO-821
public void queryMapperShouldNotTryToMapDBRefListPropertyIfNestedInsideDocumentWithinDocument() {
org.bson.Document queryObject = query(
@@ -537,10 +486,7 @@ public class QueryMapperUnitTests {
assertThat(nestedObject, is((org.bson.Document) new org.bson.Document("$keys", 0L)));
}
/**
* @see DATAMONGO-821
*/
@Test
@Test // DATAMONGO-821
public void queryMapperShouldNotTryToMapDBRefPropertyIfNestedInsideDocumentWithinDocument() {
org.bson.Document queryObject = query(
@@ -553,10 +499,7 @@ public class QueryMapperUnitTests {
assertThat(nestedObject, is((org.bson.Document) new org.bson.Document("$keys", 0L)));
}
/**
* @see DATAMONGO-821
*/
@Test
@Test // DATAMONGO-821
public void queryMapperShouldMapDBRefPropertyIfNestedInDocument() {
Reference sample = new Reference();
@@ -572,10 +515,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);
@@ -587,10 +527,7 @@ public class QueryMapperUnitTests {
assertThat(mappedFields, is(notNullValue()));
}
/**
* @see DATAMONGO-893
*/
@Test
@Test // DATAMONGO-893
public void classInformationShouldNotBePresentInDocumentUsedInFinderMethods() {
EmbeddedClass embedded = new EmbeddedClass();
@@ -605,10 +542,7 @@ public class QueryMapperUnitTests {
equalTo(org.bson.Document.parse("{ \"embedded\" : { \"$in\" : [ { \"_id\" : \"1\"} , { \"_id\" : \"2\"}]}}")));
}
/**
* @see DATAMONGO-1406
*/
@Test
@Test // DATAMONGO-1406
public void shouldMapQueryForNestedCustomizedPropertiesUsingConfiguredFieldNames() {
EmbeddedClass embeddedClass = new EmbeddedClass();
@@ -627,10 +561,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"));
@@ -639,10 +570,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("foo", -1)));
}
/**
* @see DATAMONGO-973
*/
@Test
@Test // DATAMONGO-973
public void getMappedFieldsAppendsTextScoreFieldProperlyCorrectlyWhenNotPresent() {
Query query = new Query();
@@ -653,10 +581,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("score", new org.bson.Document("$meta", "textScore"))));
}
/**
* @see DATAMONGO-973
*/
@Test
@Test // DATAMONGO-973
public void getMappedFieldsReplacesTextScoreFieldProperlyCorrectlyWhenPresent() {
Query query = new Query();
@@ -668,10 +593,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("score", new org.bson.Document("$meta", "textScore"))));
}
/**
* @see DATAMONGO-973
*/
@Test
@Test // DATAMONGO-973
public void getMappedSortAppendsTextScoreProperlyWhenSortedByScore() {
Query query = new Query().with(new Sort("textScore"));
@@ -682,10 +604,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("score", new org.bson.Document("$meta", "textScore"))));
}
/**
* @see DATAMONGO-973
*/
@Test
@Test // DATAMONGO-973
public void getMappedSortIgnoresTextScoreWhenNotSortedByScore() {
Query query = new Query().with(new Sort("id"));
@@ -696,10 +615,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("_id", 1)));
}
/**
* @see DATAMONGO-1070
*/
@Test
@Test // DATAMONGO-1070
public void mapsIdReferenceToDBRefCorrectly() {
ObjectId id = new ObjectId();
@@ -712,10 +628,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"));
@@ -726,10 +639,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("nested.id", "bar")));
}
/**
* @see DATAMONGO-1050
*/
@Test
@Test // DATAMONGO-1050
public void shouldUseExplicitlySetFieldnameForIdPropertyCandidatesUsedInSortClause() {
Query query = new Query().with(new Sort("nested.id"));
@@ -740,10 +650,7 @@ public class QueryMapperUnitTests {
assertThat(document, equalTo(new org.bson.Document().append("nested.id", 1)));
}
/**
* @see DATAMONGO-1135
*/
@Test
@Test // DATAMONGO-1135
public void nearShouldUseGeoJsonRepresentationOnUnmappedProperty() {
Query query = query(where("foo").near(new GeoJsonPoint(100, 50)));
@@ -756,10 +663,7 @@ public class QueryMapperUnitTests {
assertThat(document, 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)));
@@ -770,10 +674,7 @@ public class QueryMapperUnitTests {
assertThat(document, 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)));
@@ -784,10 +685,7 @@ public class QueryMapperUnitTests {
assertThat(document, 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)));
@@ -799,10 +697,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")
@@ -814,10 +709,7 @@ public class QueryMapperUnitTests {
assertThat(document, isBsonObject().containing("geoJsonPoint.$geoWithin.$geometry.type", "Polygon"));
}
/**
* @see DATAMONGO-1134
*/
@Test
@Test // DATAMONGO-1134
public void intersectsShouldUseGeoJsonRepresentationCorrectly() {
Query query = query(where("geoJsonPoint")
@@ -830,10 +722,7 @@ public class QueryMapperUnitTests {
assertThat(document, 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"));
@@ -844,10 +733,7 @@ public class QueryMapperUnitTests {
assertThat(document.containsKey("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"));
@@ -858,10 +744,7 @@ public class QueryMapperUnitTests {
assertThat(document.containsKey("list.1.stringProperty"), is(true));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedCorrectly() {
Foo probe = new Foo();
@@ -875,10 +758,7 @@ public class QueryMapperUnitTests {
assertThat(document, isBsonObject().containing("embedded\\._id", "conflux"));
}
/**
* @see DATAMONGO-1245
*/
@Test
@Test // DATAMONGO-1245
public void exampleShouldBeMappedCorrectlyWhenContainingLegacyPoint() {
ClassWithGeoTypes probe = new ClassWithGeoTypes();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,10 +61,7 @@ public class ReflectiveDBRefResolverUnitTests {
when(fi.first()).thenReturn(new Document("_id", "id-1"));
}
/**
* @see DATAMONGO-1193
*/
@Test
@Test // DATAMONGO-1193
public void fetchShouldNotLookUpDbWhenUsingDriverVersion2() {
assumeThat(isMongo3Driver(), is(false));
@@ -75,10 +72,7 @@ public class ReflectiveDBRefResolverUnitTests {
verify(dbFactoryMock, never()).getDb(anyString());
}
/**
* @see DATAMONGO-1193
*/
@Test
@Test // DATAMONGO-1193
public void fetchShouldUseDbToResolveDbRefWhenUsingDriverVersion3() {
assumeThat(isMongo3Driver(), is(true));
@@ -87,10 +81,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));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -93,10 +93,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"));
@@ -110,10 +107,7 @@ public class UpdateMapperUnitTests {
assertTypeHint(list, ConcreteChildClass.class);
}
/**
* @see DATAMONGO-807
*/
@Test
@Test // DATAMONGO-807
public void updateMapperShouldRetainTypeInformationForNestedEntities() {
Update update = Update.update("model", new ModelImpl(1));
@@ -127,10 +121,7 @@ public class UpdateMapperUnitTests {
assertTypeHint(modelDocument, ModelImpl.class);
}
/**
* @see DATAMONGO-807
*/
@Test
@Test // DATAMONGO-807
public void updateMapperShouldNotPersistTypeInformationForKnownSimpleTypes() {
Update update = Update.update("model.value", 1);
@@ -143,10 +134,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);
@@ -159,10 +147,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"));
@@ -176,10 +161,7 @@ public class UpdateMapperUnitTests {
assertTypeHint(modelDocument, ConcreteChildClass.class);
}
/**
* @see DATAMONGO-407
*/
@Test
@Test // DATAMONGO-407
public void updateMapperShouldSupportNestedCollectionElementUpdates() {
Update update = Update.update("list.$.value", "foo").set("list.$.otherValue", "bar");
@@ -193,10 +175,7 @@ public class UpdateMapperUnitTests {
assertThat(set.get("aliased.$.otherValue"), is("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"));
@@ -214,11 +193,8 @@ public class UpdateMapperUnitTests {
assertTypeHint(someObject, ConcreteChildClass.class);
}
/**
* @see DATAMONGO-812
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
@Test // DATAMONGO-812
public void updateMapperShouldConvertPushCorrectlyWhenCalledWithEachUsingSimpleTypes() {
Update update = new Update().push("values").each("spring", "data", "mongodb");
@@ -234,10 +210,7 @@ public class UpdateMapperUnitTests {
assertThat(each, IsIterableContainingInOrder.contains("spring", "data", "mongodb"));
}
/**
* @see DATAMONGO-812
*/
@Test
@Test // DATAMONGO-812
public void updateMapperShouldConvertPushWhithoutAddingClassInformationWhenUsedWithEvery() {
Update update = new Update().push("values").each("spring", "data", "mongodb");
@@ -250,11 +223,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"));
@@ -269,10 +239,7 @@ public class UpdateMapperUnitTests {
assertThat(values, IsIterableContainingInOrder.contains("spring", "data", "mongodb"));
}
/**
* @see DATAMONGO-812
*/
@Test
@Test // DATAMONGO-812
public void updateMapperShouldRetainClassInformationForPushCorrectlyWhenCalledWithEachUsingCustomTypes() {
Update update = new Update().push("models").each(new ListModel("spring", "data", "mongodb"));
@@ -286,10 +253,7 @@ public class UpdateMapperUnitTests {
assertTypeHint(each.get(0), ListModel.class);
}
/**
* @see DATAMONGO-812
*/
@Test
@Test // DATAMONGO-812
public void testUpdateShouldAllowMultiplePushEachForDifferentFields() {
Update update = new Update().push("category").each("spring", "data").push("type").each("mongodb");
@@ -300,10 +264,7 @@ public class UpdateMapperUnitTests {
assertThat(getAsDocument(push, "type").containsKey("$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"));
@@ -318,10 +279,7 @@ public class UpdateMapperUnitTests {
assertThat(getAsDocument(push, "key").containsKey("$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"));
@@ -336,10 +294,7 @@ public class UpdateMapperUnitTests {
assertThat(getAsDocument(push, "key").containsKey("$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"));
@@ -353,10 +308,7 @@ public class UpdateMapperUnitTests {
assertThat(getAsDocument(push, "key").containsKey("$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"));
@@ -370,10 +322,7 @@ public class UpdateMapperUnitTests {
assertThat(getAsDocument(push, "key").containsKey("$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"));
@@ -388,10 +337,7 @@ public class UpdateMapperUnitTests {
assertThat(key.containsKey("$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")
@@ -413,10 +359,7 @@ public class UpdateMapperUnitTests {
assertThat(key2.containsKey("$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);
@@ -432,10 +375,7 @@ public class UpdateMapperUnitTests {
assertThat(key.containsKey("$each"), is(true));
}
/**
* @see DATAMONGO-1141
*/
@Test
@Test // DATAMONGO-1141
public void updatePushEachWithDocumentSortShouldRenderCorrectly() {
Update update = new Update().push("list")
@@ -453,10 +393,7 @@ public class UpdateMapperUnitTests {
assertThat(key.containsKey("$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")
@@ -478,10 +415,7 @@ public class UpdateMapperUnitTests {
assertThat(key2.containsKey("$each"), is(true));
}
/**
* @see DATAMONGO-410
*/
@Test
@Test // DATAMONGO-410
public void testUpdateMapperShouldConsiderCustomWriteTarget() {
List<NestedEntity> someValues = Arrays.asList(new NestedEntity("spring"), new NestedEntity("data"),
@@ -494,10 +428,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");
@@ -509,10 +440,7 @@ public class UpdateMapperUnitTests {
assertThat(pullClause.get("dbRefAnnotatedList"), is(new DBRef("entity", "2")));
}
/**
* @see DATAMONGO-404
*/
@Test
@Test // DATAMONGO-404
public void createsDbRefForEntityOnPulls() {
Entity entity = new Entity();
@@ -526,20 +454,14 @@ public class UpdateMapperUnitTests {
assertThat(pullClause.get("dbRefAnnotatedList"), is(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");
@@ -550,10 +472,7 @@ public class UpdateMapperUnitTests {
assertThat(pullClause.containsKey("mapped.dbRefAnnotatedList"), is(true));
}
/**
* @see DATAMONGO-468
*/
@Test
@Test // DATAMONGO-468
public void rendersUpdateOfDbRefPropertyWithDomainObjectCorrectly() {
Entity entity = new Entity();
@@ -567,10 +486,7 @@ public class UpdateMapperUnitTests {
assertThat(setClause.get("dbRefProperty"), is(new DBRef("entity", entity.id)));
}
/**
* @see DATAMONGO-862
*/
@Test
@Test // DATAMONGO-862
public void rendersUpdateAndPreservesKeyForPathsNotPointingToProperty() {
Update update = new Update().set("listOfInterface.$.value", "expected-value");
@@ -581,10 +497,7 @@ public class UpdateMapperUnitTests {
assertThat(setClause.containsKey("listOfInterface.$.value"), is(true));
}
/**
* @see DATAMONGO-863
*/
@Test
@Test // DATAMONGO-863
public void doesNotConvertRawDocuments() {
Update update = new Update();
@@ -602,11 +515,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");
@@ -620,10 +530,7 @@ public class UpdateMapperUnitTests {
assertThat(each, IsIterableContainingInOrder.contains("spring", "data", "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));
@@ -640,10 +547,7 @@ public class UpdateMapperUnitTests {
}
}
/**
* @see DATAMONGO-897
*/
@Test
@Test // DATAMONGO-897
public void updateOnDbrefPropertyOfInterfaceTypeWithoutExplicitGetterForIdShouldBeMappedCorrectly() {
Update update = new Update().set("referencedDocument", new InterfaceDocumentDefinitionImpl("1", "Foo"));
@@ -657,10 +561,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")));
@@ -675,10 +576,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")));
@@ -691,10 +589,7 @@ public class UpdateMapperUnitTests {
assertThat(list, equalTo(new org.bson.Document().append("_id", "1")));
}
/**
* @see DATAMONGO-1077
*/
@Test
@Test // DATAMONGO-1077
public void shouldNotRemovePositionalParameter() {
Update update = new Update();
@@ -708,10 +603,7 @@ public class UpdateMapperUnitTests {
assertThat($unset, equalTo(new org.bson.Document().append("dbRefAnnotatedList.$", 1)));
}
/**
* @see DATAMONGO-1210
*/
@Test
@Test // DATAMONGO-1210
public void mappingEachOperatorShouldNotAddTypeInfoForNonInterfaceNonAbstractTypes() {
Update update = new Update().addToSet("nestedDocs").each(new NestedDocument("nested-1"),
@@ -724,10 +616,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));
@@ -739,10 +628,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"),
@@ -757,10 +643,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();
@@ -778,10 +661,7 @@ public class UpdateMapperUnitTests {
ModelImpl.class.getName()));
}
/**
* @see DATAMONGO-1210
*/
@Test
@Test // DATAMONGO-1210
public void mappingShouldRetainTypeInformationOfNestedListWhenUpdatingConcreteyParentType() {
ListModelWrapper lmw = new ListModelWrapper();
@@ -796,10 +676,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"));
@@ -810,10 +687,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"));
@@ -824,10 +698,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"));
@@ -838,10 +709,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<Object, Object> map = Collections.singletonMap("szeth", new NestedDocument("son-son-vallano"));
@@ -854,10 +722,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<Object, NestedDocument> map = Collections.singletonMap("jasnah", new NestedDocument("kholin"));
@@ -870,10 +735,7 @@ public class UpdateMapperUnitTests {
assertThat(mappedUpdate, isBsonObject().notContaining("$set.concreteMap.jasnah._class"));
}
/**
* @see DATAMONGO-1250
*/
@Test
@Test // DATAMONGO-1250
@SuppressWarnings("unchecked")
public void mapsUpdateWithBothReadingAndWritingConverterRegistered() {
@@ -897,10 +759,7 @@ public class UpdateMapperUnitTests {
assertThat(result, isBsonObject().containing("$set.allocation", ClassWithEnum.Allocation.AVAILABLE.code));
}
/**
* @see DATAMONGO-1251
*/
@Test
@Test // DATAMONGO-1251
public void mapsNullValueCorrectlyForSimpleTypes() {
Update update = new Update().set("value", null);
@@ -913,10 +772,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);
@@ -929,10 +785,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);
@@ -945,10 +798,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);
@@ -961,10 +811,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));
@@ -975,10 +822,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));
@@ -989,10 +833,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);
@@ -1002,10 +843,7 @@ public class UpdateMapperUnitTests {
assertThat(mappedUpdate, isBsonObject().containing("$min", new Document("minfield", 10)));
}
/**
* @see DATAMONGO-1404
*/
@Test
@Test // DATAMONGO-1404
public void mapsMaxCorrectly() {
Update update = new Update().max("maxfield", 999);
@@ -1015,10 +853,7 @@ public class UpdateMapperUnitTests {
assertThat(mappedUpdate, isBsonObject().containing("$max", new Document("maxfield", 999)));
}
/**
* @see DATAMONGO-1423
*/
@Test
@Test // DATAMONGO-1423
@SuppressWarnings("unchecked")
public void mappingShouldConsiderCustomConvertersForEnumMapKeys() {
@@ -1046,10 +881,7 @@ public class UpdateMapperUnitTests {
assertThat(enumAsMapKey.get("AVAILABLE"), is(100));
}
/**
* @see DATAMONGO-1176
*/
@Test
@Test // DATAMONGO-1176
public void mappingShouldPrepareUpdateObjectForMixedOperatorsAndFields() {
Document document = new Document("key", "value").append("$set", new Document("a", "b").append("x", "y"));
@@ -1060,10 +892,7 @@ public class UpdateMapperUnitTests {
assertThat(mappedObject.size(), is(1));
}
/**
* @see DATAMONGO-1176
*/
@Test
@Test // DATAMONGO-1176
public void mappingShouldReturnReplaceObject() {
Document document = new Document("key", "value").append("a", "b").append("x", "y");
@@ -1076,10 +905,7 @@ public class UpdateMapperUnitTests {
assertThat(mappedObject.size(), is(3));
}
/**
* @see DATAMONGO-1176
*/
@Test
@Test // DATAMONGO-1176
public void mappingShouldReturnUpdateObject() {
Document document = new Document("$push", new Document("x", "y")).append("$set", new Document("a", "b"));
@@ -1091,10 +917,7 @@ public class UpdateMapperUnitTests {
assertThat(mappedObject.size(), is(2));
}
/**
* @see DATAMONGO-1486
*/
@Test
@Test // DATAMONGO-1486
public void mappingShouldConvertMapKeysToString() {
Update update = new Update().set("map", Collections.singletonMap(25, "#StarTrek50"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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()));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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 {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -93,10 +93,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);
@@ -107,10 +104,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);
@@ -124,10 +118,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);
@@ -137,10 +128,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);
@@ -151,10 +139,7 @@ public class GeoJsonTests {
assertThat(venues.size(), is(1));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonPointTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -169,10 +154,7 @@ public class GeoJsonTests {
assertThat(result.geoJsonPoint, equalTo(obj.geoJsonPoint));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonPolygonTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -188,10 +170,7 @@ public class GeoJsonTests {
assertThat(result.geoJsonPolygon, equalTo(obj.geoJsonPolygon));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonLineStringTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -206,10 +185,7 @@ public class GeoJsonTests {
assertThat(result.geoJsonLineString, equalTo(obj.geoJsonLineString));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonMultiLineStringTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -225,10 +201,7 @@ public class GeoJsonTests {
assertThat(result.geoJsonMultiLineString, equalTo(obj.geoJsonMultiLineString));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonMultiPointTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -243,10 +216,7 @@ public class GeoJsonTests {
assertThat(result.geoJsonMultiPoint, equalTo(obj.geoJsonMultiPoint));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonMultiPolygonTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -262,10 +232,7 @@ public class GeoJsonTests {
assertThat(result.geoJsonMultiPolygon, equalTo(obj.geoJsonMultiPolygon));
}
/**
* @see DATAMONGO-1137
*/
@Test
@Test // DATAMONGO-1137
public void shouleSaveAndRetrieveDocumentWithGeoJsonGeometryCollectionTypeCorrectly() {
DocumentWithPropertyUsingGeoJsonType obj = new DocumentWithPropertyUsingGeoJsonType();
@@ -282,10 +249,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);
@@ -295,10 +259,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);
@@ -308,10 +269,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);
@@ -321,10 +279,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),

View File

@@ -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<Venue> venues = template.find(query(where("location").nearSphere(point).minDistance(0.01)), Venue.class);

View File

@@ -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);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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 {

View File

@@ -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.
@@ -63,10 +63,7 @@ public class IndexingIntegrationTests {
operations.dropCollection(IndexedPerson.class);
}
/**
* @see DATAMONGO-237
*/
@Test
@Test // DATAMONGO-237
@DirtiesContext
public void createsIndexWithFieldName() {
@@ -75,10 +72,7 @@ public class IndexingIntegrationTests {
assertThat(hasIndex("_firstname", IndexedPerson.class), is(true));
}
/**
* @see DATAMONGO-1163
*/
@Test
@Test // DATAMONGO-1163
@DirtiesContext
public void createsIndexFromMetaAnnotation() {

View File

@@ -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> indexInfo = templateOne.indexOps(RecursiveConcreteType.class).getIndexInfo();
@@ -95,10 +92,7 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests {
assertThat(indexInfo, Matchers.<IndexInfo> hasItem(hasProperty("name", is("firstName"))));
}
/**
* @DATAMONGO-1125
*/
@Test
@Test // DATAMONGO-1125
public void createIndexShouldThrowMeaningfulExceptionWhenIndexCreationFails() throws UnknownHostException {
expectedException.expect(DataIntegrityViolationException.class);

View File

@@ -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.
@@ -122,10 +122,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
verifyZeroInteractions(collection);
}
/**
* @see DATAMONGO-530
*/
@Test
@Test // DATAMONGO-530
public void isIndexCreatorForMappingContextHandedIntoConstructor() {
MongoMappingContext mappingContext = new MongoMappingContext();
@@ -136,10 +133,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);
@@ -152,10 +146,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
assertThat(optionsCaptor.getValue().getExpireAfter(TimeUnit.SECONDS), nullValue());
}
/**
* @see DATAMONGO-544
*/
@Test
@Test // DATAMONGO-544
public void expireAfterSecondsIfConfigured() {
MongoMappingContext mappingContext = prepareMappingContext(Milk.class);
@@ -166,10 +157,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
assertThat(optionsCaptor.getValue().getExpireAfter(TimeUnit.SECONDS), IsEqual.<Object> equalTo(60L));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void createsNotNestedGeoSpatialIndexCorrectly() {
MongoMappingContext mappingContext = prepareMappingContext(Wrapper.class);
@@ -184,10 +172,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
assertThat(opts.getBits(), is(26));
}
/**
* @see DATAMONGO-827
*/
@Test
@Test // DATAMONGO-827
public void autoGeneratedIndexNameShouldGenerateNoName() {
MongoMappingContext mappingContext = prepareMappingContext(EntityWithGeneratedIndexName.class);
@@ -199,10 +184,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
assertThat(optionsCaptor.getValue().getName(), nullValue());
}
/**
* @see DATAMONGO-367
*/
@Test
@Test // DATAMONGO-367
public void indexCreationShouldNotCreateNewCollectionForNestedGeoSpatialIndexStructures() {
MongoMappingContext mappingContext = prepareMappingContext(Wrapper.class);
@@ -214,10 +196,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
assertThat(collectionNameCapturer.getValue(), equalTo("wrapper"));
}
/**
* @see DATAMONGO-367
*/
@Test
@Test // DATAMONGO-367
public void indexCreationShouldNotCreateNewCollectionForNestedIndexStructures() {
MongoMappingContext mappingContext = prepareMappingContext(IndexedDocumentWrapper.class);
@@ -229,10 +208,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());
@@ -244,10 +220,7 @@ public class MongoPersistentEntityIndexCreatorUnitTests {
new MongoPersistentEntityIndexCreator(mappingContext, mongoTemplate);
}
/**
* @see DATAMONGO-1125
*/
@Test(expected = ClassCastException.class)
@Test(expected = ClassCastException.class) // DATAMONGO-1125
public void createIndexShouldNotConvertUnknownExceptionTypes() {
when(factory.getExceptionTranslator()).thenReturn(new MongoExceptionTranslator());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,10 +67,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
*/
public static class IndexResolutionTests {
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void indexPathOnLevelZeroIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -80,10 +77,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("indexedProperty", "Zero", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void indexPathOnLevelOneIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(IndexOnLevelOne.class);
@@ -92,10 +86,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("zero.indexedProperty", "One", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void depplyNestedIndexPathIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(IndexOnLevelTwo.class);
@@ -104,10 +95,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("one.zero.indexedProperty", "Two", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void resolvesIndexPathNameForNamedPropertiesCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -118,10 +106,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void resolvesIndexDefinitionCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -131,10 +116,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinition.getIndexOptions(), equalTo(new org.bson.Document().append("name", "indexedProperty")));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void resolvesIndexDefinitionOptionsCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -147,10 +129,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
.append("sparse", true).append("background", true).append("expireAfterSeconds", 10L)));
}
/**
* @see DATAMONGO-1297
*/
@Test
@Test // DATAMONGO-1297
public void resolvesIndexOnDbrefWhenDefined() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(WithDbRef.class);
@@ -160,10 +139,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions.get(0).getIndexKeys(), equalTo(new org.bson.Document().append("indexedDbRef", 1)));
}
/**
* @see DATAMONGO-1297
*/
@Test
@Test // DATAMONGO-1297
public void resolvesIndexOnDbrefWhenDefinedOnNestedElement() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -175,10 +151,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
equalTo(new org.bson.Document().append("nested.indexedDbRef", 1)));
}
/**
* @see DATAMONGO-1163
*/
@Test
@Test // DATAMONGO-1163
public void resolveIndexDefinitionInMetaAnnotatedFields() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -189,10 +162,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions.get(0).getIndexOptions(), equalTo(new org.bson.Document().append("name", "_name")));
}
/**
* @see DATAMONGO-1373
*/
@Test
@Test // DATAMONGO-1373
public void resolveIndexDefinitionInComposedAnnotatedFields() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -207,10 +177,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -335,10 +302,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
*/
public static class GeoSpatialIndexResolutionTests {
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void geoSpatialIndexPathOnLevelZeroIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -348,10 +312,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("geoIndexedProperty", "Zero", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void geoSpatialIndexPathOnLevelOneIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -361,10 +322,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("zero.geoIndexedProperty", "One", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void depplyNestedGeoSpatialIndexPathIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -374,10 +332,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("one.zero.geoIndexedProperty", "Two", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void resolvesIndexDefinitionOptionsCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -389,10 +344,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
new org.bson.Document().append("name", "location").append("min", 1).append("max", 100).append("bits", 2)));
}
/**
* @see DATAMONGO-1373
*/
@Test
@Test // DATAMONGO-1373
public void resolvesComposedAnnotationIndexDefinitionOptionsCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -463,10 +415,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
*/
public static class CompoundIndexResolutionTests {
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void compoundIndexPathOnLevelZeroIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -476,10 +425,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection(new String[] { "foo", "bar" }, "CompoundIndexOnLevelZero", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void compoundIndexOptionsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -491,10 +437,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinition.getIndexKeys(), equalTo(new org.bson.Document().append("foo", 1).append("bar", -1)));
}
/**
* @see DATAMONGO-909
*/
@Test
@Test // DATAMONGO-909
public void compoundIndexOnSuperClassResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -506,10 +449,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinition.getIndexKeys(), equalTo(new org.bson.Document().append("foo", 1).append("bar", -1)));
}
/**
* @see DATAMONGO-827
*/
@Test
@Test // DATAMONGO-827
public void compoundIndexDoesNotSpecifyNameWhenUsingGenerateName() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -521,10 +461,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinition.getIndexKeys(), equalTo(new org.bson.Document().append("foo", 1).append("bar", -1)));
}
/**
* @see DATAMONGO-929
*/
@Test
@Test // DATAMONGO-929
public void compoundIndexPathOnLevelOneIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -535,10 +472,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
indexDefinitions.get(0));
}
/**
* @see DATAMONGO-929
*/
@Test
@Test // DATAMONGO-929
public void emptyCompoundIndexPathOnLevelOneIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -549,10 +483,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
indexDefinitions.get(0));
}
/**
* @see DATAMONGO-929
*/
@Test
@Test // DATAMONGO-929
public void singleCompoundIndexPathOnLevelZeroIsResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -562,10 +493,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection(new String[] { "foo", "bar" }, "CompoundIndexOnLevelZero", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-1373
*/
@Test
@Test // DATAMONGO-1373
public void singleCompoundIndexUsingComposedAnnotationsOnTypeResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -646,10 +574,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
public static class TextIndexedResolutionTests {
/**
* @see DATAMONGO-937
*/
@Test
@Test // DATAMONGO-937
public void shouldResolveSingleFieldTextIndexCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -658,10 +583,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection("bar", "textIndexOnSinglePropertyInRoot", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-937
*/
@Test
@Test // DATAMONGO-937
public void shouldResolveMultiFieldTextIndexCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -671,10 +593,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
indexDefinitions.get(0));
}
/**
* @see DATAMONGO-937
*/
@Test
@Test // DATAMONGO-937
public void shouldResolveTextIndexOnElementCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -683,10 +602,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertIndexPathAndCollection(new String[] { "nested.foo" }, "textIndexOnNestedRoot", indexDefinitions.get(0));
}
/**
* @see DATAMONGO-937
*/
@Test
@Test // DATAMONGO-937
public void shouldResolveTextIndexOnElementWithWeightCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -699,10 +615,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(weights.get("nested.foo"), is((Object) 5F));
}
/**
* @see DATAMONGO-937
*/
@Test
@Test // DATAMONGO-937
public void shouldResolveTextIndexOnElementWithMostSpecificWeightCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -716,10 +629,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(weights.get("nested.bar"), is((Object) 10F));
}
/**
* @see DATAMONGO-937
*/
@Test
@Test // DATAMONGO-937
public void shouldSetDefaultLanguageCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -727,10 +637,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -738,10 +645,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -749,10 +653,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -760,10 +661,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, is(empty()));
}
/**
* @see DATAMONGO-1049
*/
@Test
@Test // DATAMONGO-1049
public void shouldNotCreateIndexDefinitionWhenOnlyAnnotatedLanguageButNoTextIndexPresent() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -771,10 +669,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, is(empty()));
}
/**
* @see DATAMONGO-1049
*/
@Test
@Test // DATAMONGO-1049
public void shouldPreferExplicitlyAnnotatedLanguageProperty() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -782,10 +677,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -899,10 +791,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
public static class MixedIndexResolutionTests {
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void multipleIndexesResolvedCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(MixedIndexRoot.class);
@@ -912,10 +801,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions.get(1).getIndexDefinition(), instanceOf(GeospatialIndex.class));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void cyclicPropertyReferenceOverDBRefShouldNotBeTraversed() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(Inner.class);
@@ -924,20 +810,14 @@ public class MongoPersistentEntityIndexResolverUnitTests {
equalTo(new org.bson.Document().append("outer", 1)));
}
/**
* @see DATAMONGO-899
*/
@Test
@Test // DATAMONGO-899
public void associationsShouldNotBeTraversed() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(Outer.class);
assertThat(indexDefinitions, empty());
}
/**
* @see DATAMONGO-926
*/
@Test
@Test // DATAMONGO-926
public void shouldNotRunIntoStackOverflow() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -945,10 +825,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, hasSize(1));
}
/**
* @see DATAMONGO-926
*/
@Test
@Test // DATAMONGO-926
public void indexShouldBeFoundEvenForCyclePropertyReferenceOnLevelZero() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(CycleLevelZero.class);
@@ -957,10 +834,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, hasSize(2));
}
/**
* @see DATAMONGO-926
*/
@Test
@Test // DATAMONGO-926
public void indexShouldBeFoundEvenForCyclePropertyReferenceOnLevelOne() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(CycleOnLevelOne.class);
@@ -968,10 +842,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, hasSize(1));
}
/**
* @see DATAMONGO-926
*/
@Test
@Test // DATAMONGO-926
public void indexBeResolvedCorrectlyWhenPropertiesOfDifferentTypesAreNamedEqually() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -983,10 +854,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, hasSize(3));
}
/**
* @see DATAMONGO-949
*/
@Test
@Test // DATAMONGO-949
public void shouldNotDetectCycleInSimilarlyNamedProperties() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -995,10 +863,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, hasSize(1));
}
/**
* @see DATAMONGO-962
*/
@Test
@Test // DATAMONGO-962
public void shouldDetectSelfCycleViaCollectionTypeCorrectly() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1006,10 +871,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, empty());
}
/**
* @see DATAMONGO-962
*/
@Test
@Test // DATAMONGO-962
public void shouldNotDetectCycleWhenTypeIsUsedMoreThanOnce() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1017,10 +879,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat(indexDefinitions, empty());
}
/**
* @see DATAMONGO-962
*/
@Test
@Test // DATAMONGO-962
@SuppressWarnings({ "rawtypes", "unchecked" })
public void shouldCatchCyclicReferenceExceptionOnRoot() {
@@ -1039,10 +898,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
.resolveIndexForEntity(selfCyclingEntity);
}
/**
* @see DATAMONGO-1025
*/
@Test
@Test // DATAMONGO-1025
public void shouldUsePathIndexAsIndexNameForDocumentsHavingNamedNestedCompoundIndexFixedOnCollection() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1051,10 +907,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
equalTo("propertyOfTypeHavingNamedCompoundIndex.c_index"));
}
/**
* @see DATAMONGO-1025
*/
@Test
@Test // DATAMONGO-1025
public void shouldUseIndexNameForNestedTypesWithNamedCompoundIndexDefinition() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1063,10 +916,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
equalTo("propertyOfTypeHavingNamedCompoundIndex.c_index"));
}
/**
* @see DATAMONGO-1025
*/
@Test
@Test // DATAMONGO-1025
public void shouldUsePathIndexAsIndexNameForDocumentsHavingNamedNestedIndexFixedOnCollection() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1075,10 +925,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
equalTo("propertyOfTypeHavingNamedIndex.property_index"));
}
/**
* @see DATAMONGO-1025
*/
@Test
@Test // DATAMONGO-1025
public void shouldUseIndexNameForNestedTypesWithNamedIndexDefinition() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1087,10 +934,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
equalTo("propertyOfTypeHavingNamedIndex.property_index"));
}
/**
* @see DATAMONGO-1025
*/
@Test
@Test // DATAMONGO-1025
public void shouldUseIndexNameOnRootLevel() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1098,10 +942,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1112,10 +953,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1126,10 +964,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<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(
@@ -1142,10 +977,7 @@ public class MongoPersistentEntityIndexResolverUnitTests {
}
/**
* @see DATAMONGO-1263
*/
@Test
@Test // DATAMONGO-1263
public void shouldConsiderGenericTypeArgumentsOfCollectionElements() {
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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<IndexInfo> indexInfos = indexOps.getIndexInfo();

View File

@@ -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 <a href="https://bugs.launchpad.net/querydsl/+bug/776219">https://bugs.launchpad.net/querydsl/+bug/776219</a> is fixed.
*
* @see https://bugs.launchpad.net/querydsl/+bug/776219
* @see <a href="https://bugs.launchpad.net/querydsl/+bug/776219">https://bugs.launchpad.net/querydsl/+bug/776219</a>
* @author Jon Brisbin
* @author Oliver Gierke
*/

View File

@@ -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<DocumentWithLanguage> entity = new BasicMongoPersistentEntity<DocumentWithLanguage>(
@@ -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<AnyDocument> entity = new BasicMongoPersistentEntity<AnyDocument>(
@@ -111,11 +102,8 @@ public class BasicMongoPersistentEntityUnitTests {
entity.verify();
}
/**
* @see DATAMONGO-1053
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
@Test // DATAMONGO-1053
public void verifyShouldPassForStringAsExplicitLanguageProperty() {
BasicMongoPersistentEntity<AnyDocument> entity = new BasicMongoPersistentEntity<AnyDocument>(
@@ -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<AnyDocument> entity = new BasicMongoPersistentEntity<AnyDocument>(
@@ -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<AnyDocument> entity = new BasicMongoPersistentEntity<AnyDocument>(
@@ -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<AnyDocument> entity = new BasicMongoPersistentEntity<AnyDocument>(
@@ -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<DocumentWithCustomAnnotation> entity = new BasicMongoPersistentEntity<DocumentWithCustomAnnotation>(
@@ -244,10 +214,7 @@ public class BasicMongoPersistentEntityUnitTests {
assertThat(entity.getCollection(), is("collection-1"));
}
/**
* @see DATAMONGO-1373
*/
@Test
@Test // DATAMONGO-1373
public void metaInformationShouldBeReadCorrectlyFromComposedDocumentAnnotation() {
BasicMongoPersistentEntity<DocumentWithComposedAnnotation> entity = new BasicMongoPersistentEntity<DocumentWithComposedAnnotation>(

Some files were not shown because too many files have changed in this diff Show More