Skip to content

Commit 0119af1

Browse files
christophstroblmp911de
authored andcommitted
DATAMONGO-1824 - Use Rule to verify server version in tests.
Original pull request: spring-projects#515.
1 parent 4f78aac commit 0119af1

File tree

2 files changed

+32
-80
lines changed

2 files changed

+32
-80
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@
118118
@ContextConfiguration("classpath:infrastructure.xml")
119119
public class MongoTemplateTests {
120120

121-
private static final org.springframework.data.util.Version TWO_DOT_FOUR = org.springframework.data.util.Version
122-
.parse("2.4");
123-
private static final org.springframework.data.util.Version THREE_DOT_FOUR = org.springframework.data.util.Version
124-
.parse("3.4");
125-
126121
@Autowired MongoTemplate template;
127122
@Autowired MongoDbFactory factory;
128123

@@ -2331,10 +2326,9 @@ public void updatesShouldRetainTypeInformationEvenForCollections() {
23312326
}
23322327

23332328
@Test // DATAMONGO-812
2329+
@MongoVersion(asOf = "2.4")
23342330
public void updateMultiShouldAddValuesCorrectlyWhenUsingPushEachWithComplexTypes() {
23352331

2336-
assumeThat(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR), is(true));
2337-
23382332
DocumentWithCollection document = new DocumentWithCollection(Collections.<Model> emptyList());
23392333
template.save(document);
23402334
Query query = query(where("id").is(document.id));
@@ -2347,10 +2341,9 @@ public void updateMultiShouldAddValuesCorrectlyWhenUsingPushEachWithComplexTypes
23472341
}
23482342

23492343
@Test // DATAMONGO-812
2344+
@MongoVersion(asOf = "2.4")
23502345
public void updateMultiShouldAddValuesCorrectlyWhenUsingPushEachWithSimpleTypes() {
23512346

2352-
assumeThat(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_FOUR), is(true));
2353-
23542347
DocumentWithCollectionOfSimpleType document = new DocumentWithCollectionOfSimpleType();
23552348
document.values = Arrays.asList("spring");
23562349
template.save(document);
@@ -3214,14 +3207,11 @@ public void findsByGenericNestedListElements() {
32143207
assertThat(template.findOne(query, DocumentWithCollection.class), is(equalTo(dwc)));
32153208
}
32163209

3217-
/**
3218-
* @see DATAMONGO-1517
3219-
*/
3220-
@Test
3210+
@Test // DATAMONGO-1517
3211+
@MongoVersion(asOf = "3.4")
32213212
public void decimal128TypeShouldBeSavedAndLoadedCorrectly()
32223213
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
32233214

3224-
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_FOUR), is(true));
32253215
assumeThat(MongoClientVersion.isMongo34Driver(), is(true));
32263216

32273217
Class<?> decimal128Type = ClassUtils.resolveClassName("org.bson.types.Decimal128", null);

0 commit comments

Comments
 (0)