DATACASS-758 - Polishing.

Improve assertions.
This commit is contained in:
Mark Paluch
2020-05-11 10:11:32 +02:00
parent 915147d6cd
commit 372b84a6db

View File

@@ -27,8 +27,10 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.junit.Test;
import org.springframework.core.annotation.AliasFor;
import org.springframework.data.mapping.model.Property;
import org.springframework.data.util.ClassTypeInformation;
@@ -143,10 +145,12 @@ public class BasicCassandraPersistentPropertyUnitTests {
AnnotatedParameterizedType apt = (AnnotatedParameterizedType) annotatedType;
AnnotatedType[] annotatedActualTypeArguments = apt.getAnnotatedActualTypeArguments();
assertThat(annotatedActualTypeArguments)
.extracting(a -> a.getType(), a -> Arrays.stream(a.getAnnotations()).map(an -> an instanceof Indexed).toArray())
.containsExactly(tuple(String.class, new boolean[] {}), // annotation on key type
tuple(String.class, new boolean[] { true }) // annotation on value type
.extracting(AnnotatedType::getType,
a -> Arrays.stream(a.getAnnotations()).map(Indexed.class::isInstance).findFirst())
.containsExactly(tuple(String.class, Optional.empty()), // annotation on key type
tuple(String.class, Optional.of(true)) // annotation on value type
);
}