Skip to content

Commit b4660bc

Browse files
committed
DATAREDIS-509 - Polishing.
Update license headers. Add test for index resolver using an indexed primitive array. Original pull request: #196.
1 parent 5e6d236 commit b4660bc

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/test/java/org/springframework/data/redis/core/convert/PathIndexResolverUnitTests.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-216 the original author or authors.
2+
* Copyright 2015-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,6 +55,7 @@
5555

5656
/**
5757
* @author Christoph Strobl
58+
* @author Mark Paluch
5859
*/
5960
@RunWith(MockitoJUnitRunner.class)
6061
public class PathIndexResolverUnitTests {
@@ -490,6 +491,26 @@ IsCollectionContaining.<IndexedData> hasItems(
490491
new SimpleIndexedPropertyValue(IndexedOnListField.class.getName(), "values", "arya")));
491492
}
492493

494+
/**
495+
* @see DATAREDIS-509
496+
*/
497+
@Test
498+
public void resolveIndexOnPrimitiveArrayField() {
499+
500+
IndexedOnPrimitiveArrayField source = new IndexedOnPrimitiveArrayField();
501+
source.values = new int[] { 1, 2, 3 };
502+
503+
Set<IndexedData> indexes = indexResolver
504+
.resolveIndexesFor(ClassTypeInformation.from(IndexedOnPrimitiveArrayField.class), source);
505+
506+
assertThat(indexes.size(), is(3));
507+
assertThat(indexes,
508+
IsCollectionContaining.<IndexedData> hasItems(
509+
new SimpleIndexedPropertyValue(IndexedOnPrimitiveArrayField.class.getName(), "values", 1),
510+
new SimpleIndexedPropertyValue(IndexedOnPrimitiveArrayField.class.getName(), "values", 2),
511+
new SimpleIndexedPropertyValue(IndexedOnPrimitiveArrayField.class.getName(), "values", 3)));
512+
}
513+
493514
private IndexedData resolve(String path, Object value) {
494515

495516
Set<IndexedData> data = indexResolver.resolveIndex(KEYSPACE_PERSON, path, propertyMock, value);
@@ -519,6 +540,11 @@ static class IndexedOnListField {
519540
@Indexed List<String> values;
520541
}
521542

543+
static class IndexedOnPrimitiveArrayField {
544+
545+
@Indexed int[] values;
546+
}
547+
522548
static class IndexedOnMapField {
523549

524550
@Indexed Map<String, String> values;

0 commit comments

Comments
 (0)