DATACMNS-867 - First draft.

This commit is contained in:
Oliver Gierke
2016-11-14 20:10:22 +01:00
parent 1b17271915
commit cc63e5b7a4
278 changed files with 4737 additions and 5714 deletions

View File

@@ -15,10 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.util.Set;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.springframework.data.annotation.Persistent;
@@ -35,9 +32,8 @@ public class AnnotatedTypeScannerUnitTests {
public void findsAnnotatedTypes() {
AnnotatedTypeScanner scanner = new AnnotatedTypeScanner(Persistent.class);
Set<Class<?>> types = scanner.findTypes(AnnotatedTypeScanner.class.getPackage().getName());
assertThat(types, hasItem(Type.class));
assertThat(scanner.findTypes(AnnotatedTypeScanner.class.getPackage().getName())).contains(Type.class);
}
@Persistent

View File

@@ -15,8 +15,9 @@
*/
package org.springframework.data.util;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import lombok.Value;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -41,8 +42,8 @@ public class AnnotationDetectionFieldCallbackUnitTests {
AnnotationDetectionFieldCallback callback = new AnnotationDetectionFieldCallback(Autowired.class);
ReflectionUtils.doWithFields(Sample.class, callback);
assertThat(callback.getType(), is(equalTo((Class) String.class)));
assertThat(callback.getValue(new Sample("foo")), is((Object) "foo"));
assertThat(callback.getType()).isEqualTo(String.class);
assertThat(callback.<String> getValue(new Sample("foo"))).isEqualTo("foo");
}
@Test // DATACMNS-616
@@ -51,17 +52,13 @@ public class AnnotationDetectionFieldCallbackUnitTests {
AnnotationDetectionFieldCallback callback = new AnnotationDetectionFieldCallback(Autowired.class);
ReflectionUtils.doWithFields(Empty.class, callback);
assertThat(callback.getType(), is(nullValue()));
assertThat(callback.getValue(new Empty()), is(nullValue()));
assertThat(callback.getType()).isNull();
assertThat(callback.<Object> getValue(new Empty())).isNull();
}
@Value
static class Sample {
@Autowired private final String value;
public Sample(String value) {
this.value = value;
}
@Autowired String value;
}
static class Empty {}

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import org.junit.Rule;
import org.junit.Test;
@@ -39,10 +38,10 @@ public class AnnotationDetectionMethodCallbackUnitTests {
AnnotationDetectionMethodCallback<Value> callback = new AnnotationDetectionMethodCallback<Value>(Value.class);
ReflectionUtils.doWithMethods(Sample.class, callback);
assertThat(callback.hasFoundAnnotation(), is(true));
assertThat(callback.getMethod(), is(Sample.class.getMethod("getValue")));
assertThat(callback.getAnnotation(), is(notNullValue()));
assertThat(callback.getAnnotation().value(), is("#{null}"));
assertThat(callback.hasFoundAnnotation()).isTrue();
assertThat(callback.getMethod()).isEqualTo(Sample.class.getMethod("getValue"));
assertThat(callback.getAnnotation()).isNotNull();
assertThat(callback.getAnnotation().value()).isEqualTo("#{null}");
}
@Test // DATACMNS-452

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.util.ClassTypeInformation.*;
import javaslang.collection.Traversable;
@@ -29,7 +28,6 @@ import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.springframework.data.mapping.Person;
@@ -44,25 +42,29 @@ public class ClassTypeInformationUnitTests {
public void discoversTypeForSimpleGenericField() {
TypeInformation<ConcreteType> discoverer = ClassTypeInformation.from(ConcreteType.class);
assertEquals(ConcreteType.class, discoverer.getType());
assertThat(discoverer.getType()).isEqualTo(ConcreteType.class);
TypeInformation<?> content = discoverer.getProperty("content");
assertEquals(String.class, content.getType());
assertNull(content.getComponentType());
assertNull(content.getMapValueType());
assertThat(content.getType()).isEqualTo(String.class);
assertThat(content.getComponentType()).isNull();
assertThat(content.getMapValueType()).isNull();
}
@Test
public void discoversTypeForNestedGenericField() {
TypeInformation<ConcreteWrapper> discoverer = ClassTypeInformation.from(ConcreteWrapper.class);
assertEquals(ConcreteWrapper.class, discoverer.getType());
assertThat(discoverer.getType()).isEqualTo(ConcreteWrapper.class);
TypeInformation<?> wrapper = discoverer.getProperty("wrapped");
assertEquals(GenericType.class, wrapper.getType());
assertThat(wrapper.getType()).isEqualTo(GenericType.class);
TypeInformation<?> content = wrapper.getProperty("content");
assertEquals(String.class, content.getType());
assertEquals(String.class, discoverer.getProperty("wrapped").getProperty("content").getType());
assertEquals(String.class, discoverer.getProperty("wrapped.content").getType());
assertThat(content.getType()).isEqualTo(String.class);
assertThat(discoverer.getProperty("wrapped").getProperty("content").getType()).isEqualTo(String.class);
assertThat(discoverer.getProperty("wrapped.content").getType()).isEqualTo(String.class);
}
@Test
@@ -70,7 +72,7 @@ public class ClassTypeInformationUnitTests {
public void discoversBoundType() {
TypeInformation<GenericTypeWithBound> information = ClassTypeInformation.from(GenericTypeWithBound.class);
assertEquals(Person.class, information.getProperty("person").getType());
assertThat(information.getProperty("person").getType()).isEqualTo(Person.class);
}
@Test
@@ -78,7 +80,7 @@ public class ClassTypeInformationUnitTests {
TypeInformation<SpecialGenericTypeWithBound> information = ClassTypeInformation
.from(SpecialGenericTypeWithBound.class);
assertEquals(SpecialPerson.class, information.getProperty("person").getType());
assertThat(information.getProperty("person").getType()).isEqualTo(SpecialPerson.class);
}
@Test
@@ -86,8 +88,8 @@ public class ClassTypeInformationUnitTests {
public void discoversBoundTypeForNested() {
TypeInformation<AnotherGenericType> information = ClassTypeInformation.from(AnotherGenericType.class);
assertEquals(GenericTypeWithBound.class, information.getProperty("nested").getType());
assertEquals(Person.class, information.getProperty("nested.person").getType());
assertThat(information.getProperty("nested").getType()).isEqualTo(GenericTypeWithBound.class);
assertThat(information.getProperty("nested.person").getType()).isEqualTo(Person.class);
}
@Test
@@ -95,21 +97,21 @@ public class ClassTypeInformationUnitTests {
TypeInformation<StringCollectionContainer> information = ClassTypeInformation.from(StringCollectionContainer.class);
TypeInformation<?> property = information.getProperty("array");
assertThat(property.getComponentType().getType(), is((Object) String.class));
assertThat(property.getComponentType().getType()).isEqualTo(String.class);
Class<?> type = property.getType();
assertEquals(String[].class, type);
assertThat(type.isArray(), is(true));
assertThat(type).isEqualTo(String[].class);
assertThat(type.isArray()).isTrue();
property = information.getProperty("foo");
assertEquals(Collection[].class, property.getType());
assertEquals(Collection.class, property.getComponentType().getType());
assertEquals(String.class, property.getComponentType().getComponentType().getType());
assertThat(property.getType()).isEqualTo(Collection[].class);
assertThat(property.getComponentType().getType()).isEqualTo(Collection.class);
assertThat(property.getComponentType().getComponentType().getType()).isEqualTo(String.class);
property = information.getProperty("rawSet");
assertEquals(Set.class, property.getType());
assertThat(property.getComponentType().getType(), is(Matchers.<Class<?>> equalTo(Object.class)));
assertNull(property.getMapValueType());
assertThat(property.getType()).isEqualTo(Set.class);
assertThat(property.getComponentType().getType()).isEqualTo(Object.class);
assertThat(property.getMapValueType()).isNull();
}
@Test
@@ -117,12 +119,12 @@ public class ClassTypeInformationUnitTests {
TypeInformation<StringMapContainer> information = ClassTypeInformation.from(StringMapContainer.class);
TypeInformation<?> genericMap = information.getProperty("genericMap");
assertEquals(Map.class, genericMap.getType());
assertEquals(String.class, genericMap.getMapValueType().getType());
assertThat(genericMap.getType()).isEqualTo(Map.class);
assertThat(genericMap.getMapValueType().getType()).isEqualTo(String.class);
TypeInformation<?> map = information.getProperty("map");
assertEquals(Map.class, map.getType());
assertEquals(Calendar.class, map.getMapValueType().getType());
assertThat(map.getType()).isEqualTo(Map.class);
assertThat(map.getMapValueType().getType()).isEqualTo(Calendar.class);
}
@Test
@@ -131,7 +133,7 @@ public class ClassTypeInformationUnitTests {
TypeInformation<ConcreteWrapper> first = ClassTypeInformation.from(ConcreteWrapper.class);
TypeInformation<AnotherConcreteWrapper> second = ClassTypeInformation.from(AnotherConcreteWrapper.class);
assertFalse(first.getProperty("wrapped").equals(second.getProperty("wrapped")));
assertThat(first.getProperty("wrapped").equals(second.getProperty("wrapped"))).isFalse();
}
@Test
@@ -140,19 +142,19 @@ public class ClassTypeInformationUnitTests {
TypeInformation<PropertyGetter> from = ClassTypeInformation.from(PropertyGetter.class);
TypeInformation<?> property = from.getProperty("_name");
assertThat(property, is(notNullValue()));
assertThat(property.getType(), is(typeCompatibleWith(String.class)));
assertThat(property).isNotNull();
assertThat(property.getType()).isEqualTo(String.class);
property = from.getProperty("name");
assertThat(property, is(notNullValue()));
assertThat(property.getType(), is(typeCompatibleWith(byte[].class)));
assertThat(property).isNotNull();
assertThat(property.getType()).isEqualTo(byte[].class);
}
@Test // DATACMNS-77
public void returnsSameInstanceForCachedClass() {
TypeInformation<PropertyGetter> info = ClassTypeInformation.from(PropertyGetter.class);
assertThat(ClassTypeInformation.from(PropertyGetter.class), is(sameInstance(info)));
assertThat(ClassTypeInformation.from(PropertyGetter.class)).isSameAs(info);
}
@Test // DATACMNS-39
@@ -161,15 +163,15 @@ public class ClassTypeInformationUnitTests {
TypeInformation<ClassWithWildCardBound> information = ClassTypeInformation.from(ClassWithWildCardBound.class);
TypeInformation<?> property = information.getProperty("wildcard");
assertThat(property.isCollectionLike(), is(true));
assertThat(property.getComponentType().getType(), is(typeCompatibleWith(String.class)));
assertThat(property.isCollectionLike()).isTrue();
assertThat(property.getComponentType().getType()).isEqualTo(String.class);
property = information.getProperty("complexWildcard");
assertThat(property.isCollectionLike(), is(true));
assertThat(property.isCollectionLike()).isTrue();
TypeInformation<?> component = property.getComponentType();
assertThat(component.isCollectionLike(), is(true));
assertThat(component.getComponentType().getType(), is(typeCompatibleWith(String.class)));
assertThat(component.isCollectionLike()).isTrue();
assertThat(component.getComponentType().getType()).isEqualTo(String.class);
}
@Test
@@ -179,9 +181,9 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> superTypeInformation = information.getSuperTypeInformation(GenericType.class);
List<TypeInformation<?>> parameters = superTypeInformation.getTypeArguments();
assertThat(parameters, hasSize(2));
assertThat(parameters.get(0).getType(), is((Object) String.class));
assertThat(parameters.get(1).getType(), is((Object) Object.class));
assertThat(parameters).hasSize(2);
assertThat(parameters.get(0).getType()).isEqualTo(String.class);
assertThat(parameters.get(1).getType()).isEqualTo(Object.class);
}
@Test
@@ -191,8 +193,8 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> superTypeInformation = information.getSuperTypeInformation(Base.class);
List<TypeInformation<?>> parameters = superTypeInformation.getTypeArguments();
assertThat(parameters, hasSize(1));
assertThat(parameters.get(0).getType(), is((Object) String.class));
assertThat(parameters).hasSize(1);
assertThat(parameters.get(0).getType()).isEqualTo(String.class);
}
@Test
@@ -203,9 +205,9 @@ public class ClassTypeInformationUnitTests {
List<TypeInformation<?>> informations = information.getParameterTypes(method);
TypeInformation<?> returnTypeInformation = information.getReturnType(method);
assertThat(informations, hasSize(1));
assertThat(informations.get(0).getType(), is((Object) Base.class));
assertThat(informations.get(0), is((Object) returnTypeInformation));
assertThat(informations).hasSize(1);
assertThat(informations.get(0).getType()).isEqualTo(Base.class);
assertThat(informations.get(0)).isEqualTo(returnTypeInformation);
}
@Test
@@ -217,11 +219,11 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> parameterType = information.getParameterTypes(method).get(0);
TypeInformation<StringImplementation> stringInfo = from(StringImplementation.class);
assertThat(parameterType.isAssignableFrom(stringInfo), is(true));
assertThat(stringInfo.getSuperTypeInformation(GenericInterface.class), is((Object) parameterType));
assertThat(parameterType.isAssignableFrom(from(LongImplementation.class)), is(false));
assertThat(parameterType.isAssignableFrom(stringInfo)).isTrue();
assertThat(stringInfo.getSuperTypeInformation(GenericInterface.class)).isEqualTo(parameterType);
assertThat(parameterType.isAssignableFrom(from(LongImplementation.class))).isFalse();
assertThat(parameterType
.isAssignableFrom(from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class)), is(true));
.isAssignableFrom(from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class))).isTrue();
}
@Test
@@ -232,10 +234,10 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> parameterType = information.getParameterTypes(method).get(0);
assertThat(parameterType.isAssignableFrom(from(StringImplementation.class)), is(false));
assertThat(parameterType.isAssignableFrom(from(LongImplementation.class)), is(true));
assertThat(parameterType.isAssignableFrom(from(StringImplementation.class))).isFalse();
assertThat(parameterType.isAssignableFrom(from(LongImplementation.class))).isTrue();
assertThat(parameterType
.isAssignableFrom(from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class)), is(false));
.isAssignableFrom(from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class))).isFalse();
}
@Test
@@ -246,19 +248,19 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> parameterType = information.getParameterTypes(method).get(0);
assertThat(parameterType.isAssignableFrom(from(StringImplementation.class)), is(false));
assertThat(parameterType.isAssignableFrom(from(LongImplementation.class)), is(true));
assertThat(parameterType.isAssignableFrom(from(StringImplementation.class))).isFalse();
assertThat(parameterType.isAssignableFrom(from(LongImplementation.class))).isTrue();
assertThat(parameterType
.isAssignableFrom(from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class)), is(false));
.isAssignableFrom(from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class))).isFalse();
}
@Test
public void returnsComponentTypeForMultiDimensionalArrayCorrectly() {
TypeInformation<?> information = from(String[][].class);
assertThat(information.getType(), is((Object) String[][].class));
assertThat(information.getComponentType().getType(), is((Object) String[].class));
assertThat(information.getActualType().getActualType().getType(), is((Object) String.class));
assertThat(information.getType()).isEqualTo(String[][].class);
assertThat(information.getComponentType().getType()).isEqualTo(String[].class);
assertThat(information.getActualType().getActualType().getType()).isEqualTo(String.class);
}
@Test // DATACMNS-309
@@ -268,8 +270,8 @@ public class ClassTypeInformationUnitTests {
TypeInformation<Product> information = from(Product.class);
TypeInformation<?> categoryIdInfo = information.getProperty("category.id");
assertThat(categoryIdInfo, is(notNullValue()));
assertThat(categoryIdInfo, is((TypeInformation) from(Long.class)));
assertThat(categoryIdInfo).isNotNull();
assertThat(categoryIdInfo).isEqualTo((TypeInformation) from(Long.class));
}
@Test(expected = IllegalArgumentException.class) // DATACMNS-387
@@ -280,8 +282,8 @@ public class ClassTypeInformationUnitTests {
@Test // DATACMNS-422
public void returnsNullForRawTypesOnly() {
assertThat(from(MyRawIterable.class).getComponentType(), is(nullValue()));
assertThat(from(MyIterable.class).getComponentType(), is(notNullValue()));
assertThat(from(MyRawIterable.class).getComponentType()).isNull();
assertThat(from(MyIterable.class).getComponentType()).isNotNull();
}
@Test // DATACMNS-440
@@ -290,22 +292,21 @@ public class ClassTypeInformationUnitTests {
TypeInformation<SuperGenerics> information = ClassTypeInformation.from(SuperGenerics.class);
TypeInformation<?> propertyInformation = information.getProperty("seriously");
assertThat(propertyInformation.getType(), is((Object) SortedMap.class));
assertThat(propertyInformation.getType()).isEqualTo(SortedMap.class);
TypeInformation<?> mapValueType = propertyInformation.getMapValueType();
assertThat(mapValueType.getType(), is((Object) SortedMap.class));
assertThat(mapValueType.getComponentType().getType(), is((Object) String.class));
assertThat(mapValueType.getType()).isEqualTo(SortedMap.class);
assertThat(mapValueType.getComponentType().getType()).isEqualTo(String.class);
TypeInformation<?> nestedValueType = mapValueType.getMapValueType();
assertThat(nestedValueType.getType(), is((Object) List.class));
assertThat(nestedValueType.getComponentType().getType(), is((Object) Person.class));
assertThat(nestedValueType.getType()).isEqualTo(List.class);
assertThat(nestedValueType.getComponentType().getType()).isEqualTo(Person.class);
}
@Test // DATACMNS-446
public void createsToStringRepresentation() {
assertThat(from(SpecialPerson.class).toString(),
is("org.springframework.data.util.ClassTypeInformationUnitTests$SpecialPerson"));
assertThat(from(SpecialPerson.class).toString())
.isEqualTo("org.springframework.data.util.ClassTypeInformationUnitTests$SpecialPerson");
}
@Test // DATACMNS-590
@@ -316,7 +317,7 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> subsElementType = subsPropertyType.getActualType();
TypeInformation<?> subSubType = subsElementType.getProperty("subSub");
assertThat(subSubType.getType(), is((Object) ConcreteSubSub.class));
assertThat(subSubType.getType()).isEqualTo(ConcreteSubSub.class);
}
@Test // DATACMNS-594
@@ -325,7 +326,7 @@ public class ClassTypeInformationUnitTests {
ClassTypeInformation<ConcreteRootIntermediate> customer = ClassTypeInformation.from(ConcreteRootIntermediate.class);
TypeInformation<?> leafType = customer.getProperty("intermediate.content.intermediate.content");
assertThat(leafType.getType(), is((Object) Leaf.class));
assertThat(leafType.getType()).isEqualTo(Leaf.class);
}
@Test // DATACMNS-783, DATACMNS-853
@@ -336,9 +337,9 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> specialized = property.specialize(ClassTypeInformation.from(Bar.class));
assertThat(specialized.getType(), is((Object) Bar.class));
assertThat(specialized.getProperty("field").getType(), is((Object) Character.class));
assertThat(specialized.getProperty("anotherField").getType(), is((Object) Integer.class));
assertThat(specialized.getType()).isEqualTo(Bar.class);
assertThat(specialized.getProperty("field").getType()).isEqualTo(Character.class);
assertThat(specialized.getProperty("anotherField").getType()).isEqualTo(Integer.class);
}
@Test // DATACMNS-783
@@ -349,7 +350,7 @@ public class ClassTypeInformationUnitTests {
TypeInformation<?> property = root.getProperty("object");
ClassTypeInformation<?> from = ClassTypeInformation.from(Bar.class);
assertThat(property.specialize(from), is((TypeInformation) from));
assertThat(property.specialize(from)).isEqualTo((TypeInformation) from);
}
@Test // DATACMNS-855
@@ -362,9 +363,9 @@ public class ClassTypeInformationUnitTests {
TypeInformation left = property.specialize(ClassTypeInformation.from(Bar.class));
TypeInformation right = property.specialize(ClassTypeInformation.from(Bar.class));
assertThat(left, is(right));
assertThat(right, is(left));
assertThat(left.hashCode(), is(right.hashCode()));
assertThat(left).isEqualTo(right);
assertThat(right).isEqualTo(left);
assertThat(left.hashCode()).isEqualTo(right.hashCode());
}
@Test // DATACMNS-896
@@ -372,7 +373,7 @@ public class ClassTypeInformationUnitTests {
ClassTypeInformation<Concrete> information = ClassTypeInformation.from(Concrete.class);
assertThat(information.getProperty("field").getType(), is(typeCompatibleWith(Nested.class)));
assertThat(information.getProperty("field").getType()).isEqualTo(Nested.class);
}
@Test // DATACMNS-940

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import java.util.HashSet;
import java.util.Set;
@@ -41,8 +40,8 @@ public class DataCmns511Tests {
TypeInformation<?> thirdRoleType = secondCreatedBy.getProperty("roles").getActualType();
TypeInformation thirdCreatedBy = thirdRoleType.getProperty("createdBy");
assertThat(secondCreatedBy, is(thirdCreatedBy));
assertThat(secondCreatedBy.hashCode(), is(thirdCreatedBy.hashCode()));
assertThat(secondCreatedBy).isEqualTo(thirdCreatedBy);
assertThat(secondCreatedBy.hashCode()).isEqualTo(thirdCreatedBy.hashCode());
}
static class AbstractRole<USER extends AbstractUser<USER, ROLE>, ROLE extends AbstractRole<USER, ROLE>> extends

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.springframework.beans.BeanWrapper;
@@ -38,7 +37,7 @@ public class DirectFieldAccessFallbackBeanWrapperUnitTests {
BeanWrapper wrapper = new DirectFieldAccessFallbackBeanWrapper(sample);
assertThat(wrapper.getPropertyValue("firstname"), is((Object) "Dave"));
assertThat(wrapper.getPropertyValue("firstname")).isEqualTo("Dave");
}
@Test // DATACMNS-452
@@ -49,7 +48,7 @@ public class DirectFieldAccessFallbackBeanWrapperUnitTests {
BeanWrapper wrapper = new DirectFieldAccessFallbackBeanWrapper(sample);
wrapper.setPropertyValue("firstname", "Dave");
assertThat(sample.firstname, is("Dave"));
assertThat(sample.firstname).isEqualTo("Dave");
}
@Test(expected = NotReadablePropertyException.class) // DATACMNS-452

View File

@@ -0,0 +1,58 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.util;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import java.util.Optional;
import java.util.function.Supplier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
/**
* @author Oliver Gierke
*/
@RunWith(MockitoJUnitRunner.class)
public class LazyUnitTests {
@Mock Supplier<String> supplier;
@Mock Supplier<Optional<String>> optionalSupplier;
@Test
public void invokesSupplierOnFirstAccess() {
doReturn("foo").when(supplier).get();
Lazy<String> lazy = Lazy.of(supplier);
assertThat(lazy.get()).isEqualTo("foo");
assertThat(lazy.get()).isEqualTo("foo");
verify(supplier, times(1)).get();
}
@Test
public void createsLazyOptional() {
doReturn(Optional.empty()).when(optionalSupplier).get();
assertThat(Lazy.of(optionalSupplier).get()).isEmpty();
}
}

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
@@ -32,8 +31,8 @@ public class PairUnitTests {
Pair<Integer, Integer> pair = Pair.of(1, 2);
assertThat(pair.getFirst(), is(1));
assertThat(pair.getSecond(), is(2));
assertThat(pair.getFirst()).isEqualTo(1);
assertThat(pair.getSecond()).isEqualTo(2);
}
@Test(expected = IllegalArgumentException.class) // DATACMNS-790
@@ -52,9 +51,9 @@ public class PairUnitTests {
Pair<Integer, Integer> first = Pair.of(1, 2);
Pair<Integer, Integer> second = Pair.of(1, 2);
assertThat(first, is(first));
assertThat(first, is(second));
assertThat(second, is(first));
assertThat(first).isEqualTo(first);
assertThat(first).isEqualTo(second);
assertThat(second).isEqualTo(first);
}
@Test // DATACMNS-790
@@ -64,7 +63,7 @@ public class PairUnitTests {
Pair<Integer, Integer> second = Pair.of(1, 2);
Pair<Integer, Integer> third = Pair.of(2, 2);
assertThat(first.hashCode(), is(second.hashCode()));
assertThat(first.hashCode(), is(not(third.hashCode())));
assertThat(first.hashCode()).isEqualTo(second.hashCode());
assertThat(first.hashCode()).isNotEqualTo(third.hashCode());
}
}

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.springframework.data.util.ClassTypeInformation.*;
@@ -59,10 +58,10 @@ public class ParameterizedTypeUnitTests {
TypeDiscoverer<String> stringParent = new TypeDiscoverer<String>(String.class, EMPTY_MAP);
TypeDiscoverer<Object> objectParent = new TypeDiscoverer<Object>(Object.class, EMPTY_MAP);
ParameterizedTypeInformation<Object> first = new ParameterizedTypeInformation<Object>(one, stringParent, EMPTY_MAP);
ParameterizedTypeInformation<Object> second = new ParameterizedTypeInformation<Object>(one, objectParent, EMPTY_MAP);
ParameterizedTypeInformation<Object> first = new ParameterizedTypeInformation<>(one, stringParent, EMPTY_MAP);
ParameterizedTypeInformation<Object> second = new ParameterizedTypeInformation<>(one, objectParent, EMPTY_MAP);
assertThat(first, is(not(second)));
assertThat(first).isNotEqualTo(second);
}
@Test
@@ -70,10 +69,10 @@ public class ParameterizedTypeUnitTests {
TypeDiscoverer<String> stringParent = new TypeDiscoverer<String>(String.class, EMPTY_MAP);
ParameterizedTypeInformation<Object> first = new ParameterizedTypeInformation<Object>(one, stringParent, EMPTY_MAP);
ParameterizedTypeInformation<Object> second = new ParameterizedTypeInformation<Object>(one, stringParent, EMPTY_MAP);
ParameterizedTypeInformation<Object> first = new ParameterizedTypeInformation<>(one, stringParent, EMPTY_MAP);
ParameterizedTypeInformation<Object> second = new ParameterizedTypeInformation<>(one, stringParent, EMPTY_MAP);
assertTrue(first.equals(second));
assertThat(first.equals(second)).isTrue();
}
@Test // DATACMNS-88
@@ -81,19 +80,19 @@ public class ParameterizedTypeUnitTests {
TypeInformation<Foo> type = ClassTypeInformation.from(Foo.class);
TypeInformation<?> propertyType = type.getProperty("param");
assertThat(propertyType.getProperty("value").getType(), is(typeCompatibleWith(String.class)));
assertThat(propertyType.getMapValueType().getType(), is(typeCompatibleWith(String.class)));
assertThat(propertyType.getProperty("value").getType()).isEqualTo(String.class);
assertThat(propertyType.getMapValueType().getType()).isEqualTo(String.class);
propertyType = type.getProperty("param2");
assertThat(propertyType.getProperty("value").getType(), is(typeCompatibleWith(String.class)));
assertThat(propertyType.getMapValueType().getType(), is(typeCompatibleWith(Locale.class)));
assertThat(propertyType.getProperty("value").getType()).isEqualTo(String.class);
assertThat(propertyType.getMapValueType().getType()).isEqualTo(Locale.class);
}
@Test // DATACMNS-446
public void createsToStringRepresentation() {
assertThat(from(Foo.class).getProperty("param").toString(),
is("org.springframework.data.util.ParameterizedTypeUnitTests$Localized<java.lang.String>"));
assertThat(from(Foo.class).getProperty("param").toString())
.isEqualTo("org.springframework.data.util.ParameterizedTypeUnitTests$Localized<java.lang.String>");
}
@Test // DATACMNS-485
@@ -103,8 +102,8 @@ public class ParameterizedTypeUnitTests {
TypeInformation first = from(First.class).getProperty("property");
TypeInformation second = from(Second.class).getProperty("property");
assertThat(first, is(second));
assertThat(first.hashCode(), is(second.hashCode()));
assertThat(first).isEqualTo(second);
assertThat(first.hashCode()).isEqualTo(second.hashCode());
}
@Test // DATACMNS-485
@@ -112,7 +111,7 @@ public class ParameterizedTypeUnitTests {
public void getActualTypeShouldNotUnwrapParameterizedTypes() {
TypeInformation type = from(First.class).getProperty("property");
assertThat(type.getActualType(), is(type));
assertThat(type.getActualType()).isEqualTo(type);
}
@Test // DATACMNS-697
@@ -120,17 +119,17 @@ public class ParameterizedTypeUnitTests {
TypeInformation<NormalizedProfile> information = ClassTypeInformation.from(NormalizedProfile.class);
TypeInformation<?> valueType = information.getProperty("education2.data").getComponentType();
assertThat(valueType.getProperty("value").getType(), is(typeCompatibleWith(Education.class)));
assertThat(valueType.getProperty("value").getType()).isEqualTo(Education.class);
}
@Test // DATACMNS-899
public void returnsNullMapValueTypeForNonMapProperties(){
public void returnsNullMapValueTypeForNonMapProperties() {
TypeInformation<?> valueType = ClassTypeInformation.from(Bar.class).getProperty("param");
TypeInformation<?> mapValueType = valueType.getMapValueType();
assertThat(valueType, instanceOf(ParameterizedTypeInformation.class));
assertThat(mapValueType, is(nullValue()));
assertThat(valueType).isInstanceOf(ParameterizedTypeInformation.class);
assertThat(mapValueType).isNull();
}
@SuppressWarnings("serial")

View File

@@ -16,8 +16,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import java.util.List;
@@ -46,14 +45,12 @@ public class ParsingUtilsUnitTests {
+ "Suffix";
List<String> result = ParsingUtils.splitCamelCaseToLower(sample);
assertThat(
result,
contains("prefix", "이름", "anders", "øre", "år", "property1", "생일", "foo_bar", "foo_bar", "bar$foo", "bar$foo",
"suffix"));
assertThat(result).contains("prefix", "이름", "anders", "øre", "år", "property1", "생일", "foo_bar", "foo_bar",
"bar$foo", "bar$foo", "suffix");
}
@Test // DATCMNS-486
public void reconcatenatesCamelCaseString() {
assertThat(ParsingUtils.reconcatenateCamelCase("myCamelCase", "-"), is("my-camel-case"));
assertThat(ParsingUtils.reconcatenateCamelCase("myCamelCase", "-")).isEqualTo("my-camel-case");
}
}

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -45,14 +44,14 @@ public class ReflectionUtilsUnitTests {
public void findsFieldByFilter() {
Field field = ReflectionUtils.findField(Sample.class, (FieldFilter) new FieldNameFieldFilter("field"));
assertThat(field, is(reference));
assertThat(field).isEqualTo(reference);
}
@Test
public void returnsNullIfNoFieldFound() {
Field field = ReflectionUtils.findField(Sample.class, (FieldFilter) new FieldNameFieldFilter("foo"));
assertThat(field, is(nullValue()));
assertThat(field).isNull();
}
@Test(expected = IllegalStateException.class)
@@ -64,7 +63,7 @@ public class ReflectionUtilsUnitTests {
public void findsUniqueField() {
Field field = ReflectionUtils.findField(Sample.class, new FieldNameFieldFilter("field"), false);
assertThat(field, is(reference));
assertThat(field).isEqualTo(reference);
}
@Test
@@ -75,7 +74,7 @@ public class ReflectionUtilsUnitTests {
}
Field field = ReflectionUtils.findField(Subclass.class, new FieldNameFieldFilter("field"));
assertThat(field, is(reference));
assertThat(field).isEqualTo(reference);
}
@Test
@@ -84,27 +83,27 @@ public class ReflectionUtilsUnitTests {
Sample sample = new Sample();
Field field = ReflectionUtils.findField(Sample.class, new FieldNameFieldFilter("first"));
ReflectionUtils.setField(field, sample, "foo");
assertThat(sample.first, is("foo"));
assertThat(sample.first).isEqualTo("foo");
}
@Test // DATACMNS-542
public void detectsConstructorForCompleteMatch() throws Exception {
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, 2, "test"), is(constructor));
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, 2, "test")).hasValue(constructor);
}
@Test // DATACMNS-542
public void detectsConstructorForMatchWithNulls() throws Exception {
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, 2, null), is(constructor));
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, 2, null)).hasValue(constructor);
}
@Test // DATACMNS-542
public void rejectsConstructorIfNumberOfArgumentsDontMatch() throws Exception {
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, 2, "test", "test"), is(nullValue()));
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, 2, "test", "test")).isNotPresent();
}
@Test // DATACMNS-542
public void rejectsConstructorForNullForPrimitiveArgument() throws Exception {
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, null, "test"), is(nullValue()));
assertThat(ReflectionUtils.findConstructor(ConstructorDetection.class, null, "test")).isNotPresent();
}
static class Sample {

View File

@@ -15,9 +15,8 @@
*/
package org.springframework.data.util;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.util.StreamUtils.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.List;
@@ -41,6 +40,6 @@ public class StreamUtilsTests {
Stream<String> stream = createStreamFromIterator(input.iterator());
List<String> output = stream.collect(Collectors.<String> toList());
assertThat(input, is(equalTo(output)));
assertThat(input).isEqualTo(output);
}
}

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.util.ClassTypeInformation.*;
import java.lang.reflect.Constructor;
@@ -57,18 +56,18 @@ public class TypeDiscovererUnitTests {
TypeDiscoverer<Object> objectTypeInfo = new TypeDiscoverer<Object>(Object.class, EMPTY_MAP);
TypeDiscoverer<String> stringTypeInfo = new TypeDiscoverer<String>(String.class, EMPTY_MAP);
assertFalse(objectTypeInfo.equals(stringTypeInfo));
assertThat(objectTypeInfo.equals(stringTypeInfo)).isFalse();
}
@Test
public void isNotEqualIfTypeVariableMapsDiffer() {
assertFalse(firstMap.equals(secondMap));
assertThat(firstMap.equals(secondMap)).isFalse();
TypeDiscoverer<Object> first = new TypeDiscoverer<Object>(Object.class, firstMap);
TypeDiscoverer<Object> second = new TypeDiscoverer<Object>(Object.class, secondMap);
assertFalse(first.equals(second));
assertThat(first.equals(second)).isFalse();
}
@Test
@@ -78,7 +77,7 @@ public class TypeDiscovererUnitTests {
TypeInformation<?> first = information.getProperty("parent").getMapValueType();
TypeInformation<?> second = first.getProperty("map").getMapValueType();
assertEquals(first, second);
assertThat(second).isEqualTo(first);
}
@Test
@@ -87,7 +86,7 @@ public class TypeDiscovererUnitTests {
TypeInformation<SelfReferencingMap> information = from(SelfReferencingMap.class);
TypeInformation<?> mapValueType = information.getProperty("map").getMapValueType();
assertEquals(mapValueType, information);
assertThat(information).isEqualTo(mapValueType);
}
@Test
@@ -95,16 +94,17 @@ public class TypeDiscovererUnitTests {
TypeInformation<?> discoverer = new TypeDiscoverer<Object>(CustomMap.class, EMPTY_MAP);
assertEquals(Locale.class, discoverer.getMapValueType().getType());
assertEquals(String.class, discoverer.getComponentType().getType());
assertThat(discoverer.getMapValueType().getType()).isEqualTo(Locale.class);
assertThat(discoverer.getComponentType().getType()).isEqualTo(String.class);
}
@Test
public void returnsComponentTypeForCollectionExtension() {
TypeDiscoverer<CustomCollection> discoverer = new TypeDiscoverer<CustomCollection>(CustomCollection.class, firstMap);
TypeDiscoverer<CustomCollection> discoverer = new TypeDiscoverer<CustomCollection>(CustomCollection.class,
firstMap);
assertEquals(String.class, discoverer.getComponentType().getType());
assertThat(discoverer.getComponentType().getType()).isEqualTo(String.class);
}
@Test
@@ -112,7 +112,7 @@ public class TypeDiscovererUnitTests {
TypeDiscoverer<String[]> discoverer = new TypeDiscoverer<String[]>(String[].class, EMPTY_MAP);
assertEquals(String.class, discoverer.getComponentType().getType());
assertThat(discoverer.getComponentType().getType()).isEqualTo(String.class);
}
@Test // DATACMNS-57
@@ -124,9 +124,9 @@ public class TypeDiscovererUnitTests {
Constructor<GenericConstructors> constructor = GenericConstructors.class.getConstructor(List.class, Locale.class);
List<TypeInformation<?>> types = discoverer.getParameterTypes(constructor);
assertThat(types.size(), is(2));
assertThat(types.get(0).getType(), equalTo((Class) List.class));
assertThat(types.get(0).getComponentType().getType(), is(equalTo((Class) String.class)));
assertThat(types).hasSize(2);
assertThat(types.get(0).getType()).isEqualTo(List.class);
assertThat(types.get(0).getComponentType().getType()).isEqualTo(String.class);
}
@Test
@@ -135,8 +135,8 @@ public class TypeDiscovererUnitTests {
TypeDiscoverer<Map> discoverer = new TypeDiscoverer<Map>(Map.class, EMPTY_MAP);
assertThat(discoverer.getComponentType(), is(nullValue()));
assertThat(discoverer.getMapValueType(), is(nullValue()));
assertThat(discoverer.getComponentType()).isNull();
assertThat(discoverer.getMapValueType()).isNull();
}
@Test // DATACMNS-167
@@ -148,13 +148,13 @@ public class TypeDiscovererUnitTests {
TypeInformation<?> addresses = discoverer.getProperty("addresses");
assertThat(addresses.isCollectionLike(), is(false));
assertThat(addresses.getComponentType(), is(reference));
assertThat(addresses.isCollectionLike()).isFalse();
assertThat(addresses.getComponentType()).isEqualTo(reference);
TypeInformation<?> adressIterable = discoverer.getProperty("addressIterable");
assertThat(adressIterable.isCollectionLike(), is(true));
assertThat(adressIterable.getComponentType(), is(reference));
assertThat(adressIterable.isCollectionLike()).isTrue();
assertThat(adressIterable.getComponentType()).isEqualTo(reference);
}
class Person {

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.util;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import org.hamcrest.Matchers;
import org.junit.Rule;
@@ -38,8 +37,8 @@ public class VersionUnitTests {
Version first = new Version(6);
Version second = new Version(6);
assertThat(first, is(second));
assertThat(second, is(first));
assertThat(first).isEqualTo(second);
assertThat(second).isEqualTo(first);
}
@Test // DATCMNS-384
@@ -48,8 +47,8 @@ public class VersionUnitTests {
Version first = new Version(5, 2);
Version second = new Version(5, 2);
assertThat(first, is(second));
assertThat(second, is(first));
assertThat(first).isEqualTo(second);
assertThat(second).isEqualTo(first);
}
@Test // DATCMNS-384
@@ -58,8 +57,8 @@ public class VersionUnitTests {
Version first = new Version(1, 2, 3);
Version second = new Version(1, 2, 3);
assertThat(first, is(second));
assertThat(second, is(first));
assertThat(first).isEqualTo(second);
assertThat(second).isEqualTo(first);
}
@Test // DATCMNS-384
@@ -68,36 +67,36 @@ public class VersionUnitTests {
Version first = new Version(1, 2, 3, 1000);
Version second = new Version(1, 2, 3, 1000);
assertThat(first, is(second));
assertThat(second, is(first));
assertThat(first).isEqualTo(second);
assertThat(second).isEqualTo(first);
}
@Test // DATCMNS-384
public void parsesVersionCorrectlyOneDigits() {
Version version = Version.parse("5");
assertThat(version, is(new Version(5)));
assertThat(version).isEqualTo(new Version(5));
}
@Test // DATCMNS-384
public void parsesVersionCorrectlyTwoDigits() {
Version version = Version.parse("5.2");
assertThat(version, is(new Version(5, 2)));
assertThat(version).isEqualTo(new Version(5, 2));
}
@Test // DATCMNS-384
public void parsesVersionCorrectlyThreeDigits() {
Version version = Version.parse("12.1.3");
assertThat(version, is(new Version(12, 1, 3)));
assertThat(version).isEqualTo(new Version(12, 1, 3));
}
@Test // DATCMNS-384
public void parsesVersionCorrectlyFourDigits() {
Version version = Version.parse("12.1.3.1000");
assertThat(version, is(new Version(12, 1, 3, 1000)));
assertThat(version).isEqualTo(new Version(12, 1, 3, 1000));
}
@Test // DATCMNS-384
@@ -109,49 +108,49 @@ public class VersionUnitTests {
Version nextMinor = new Version(1, 3);
Version nextMajor = new Version(2);
assertThat(nextMajor.isGreaterThan(nextMinor), is(true));
assertThat(nextMajor.isGreaterThan(nextMajor), is(false));
assertThat(nextMajor.is(nextMajor), is(true));
assertThat(nextMinor.isLessThan(nextMajor), is(true));
assertThat(nextMinor.isLessThan(nextMinor), is(false));
assertThat(nextMajor.isGreaterThan(nextMinor)).isTrue();
assertThat(nextMajor.isGreaterThan(nextMajor)).isFalse();
assertThat(nextMajor.is(nextMajor)).isTrue();
assertThat(nextMinor.isLessThan(nextMajor)).isTrue();
assertThat(nextMinor.isLessThan(nextMinor)).isFalse();
assertThat(nextMajor.compareTo(nextMajor), is(0));
assertThat(nextMinor.compareTo(nextMinor), is(0));
assertThat(nextBugfix.compareTo(nextBugfix), is(0));
assertThat(nextBuild.compareTo(nextBuild), is(0));
assertThat(nextMajor.compareTo(nextMajor)).isEqualTo(0);
assertThat(nextMinor.compareTo(nextMinor)).isEqualTo(0);
assertThat(nextBugfix.compareTo(nextBugfix)).isEqualTo(0);
assertThat(nextBuild.compareTo(nextBuild)).isEqualTo(0);
assertThat(version.compareTo(nextMajor), is(lessThan(0)));
assertThat(version.compareTo(nextMinor), is(lessThan(0)));
assertThat(version.compareTo(nextBugfix), is(lessThan(0)));
assertThat(version.compareTo(nextBuild), is(lessThan(0)));
assertThat(version.compareTo(nextMajor)).isLessThan(0);
assertThat(version.compareTo(nextMinor)).isLessThan(0);
assertThat(version.compareTo(nextBugfix)).isLessThan(0);
assertThat(version.compareTo(nextBuild)).isLessThan(0);
assertThat(version.compareTo(null), is(greaterThan(0)));
assertThat(nextMajor.compareTo(version), is(greaterThan(0)));
assertThat(nextMinor.compareTo(version), is(greaterThan(0)));
assertThat(nextBugfix.compareTo(version), is(greaterThan(0)));
assertThat(nextBuild.compareTo(version), is(greaterThan(0)));
assertThat(version.compareTo(null)).isGreaterThan(0);
assertThat(nextMajor.compareTo(version)).isGreaterThan(0);
assertThat(nextMinor.compareTo(version)).isGreaterThan(0);
assertThat(nextBugfix.compareTo(version)).isGreaterThan(0);
assertThat(nextBuild.compareTo(version)).isGreaterThan(0);
}
@Test // DATCMNS-384
public void removesTrailingZerosAfterSecondValueForToString() {
assertThat(new Version(2).toString(), is("2.0"));
assertThat(new Version(2, 0).toString(), is("2.0"));
assertThat(new Version(2, 0, 0).toString(), is("2.0"));
assertThat(new Version(2, 0, 0, 0).toString(), is("2.0"));
assertThat(new Version(2, 0, 1).toString(), is("2.0.1"));
assertThat(new Version(2, 0, 1, 0).toString(), is("2.0.1"));
assertThat(new Version(2, 0, 0, 1).toString(), is("2.0.0.1"));
assertThat(new Version(2).toString()).isEqualTo("2.0");
assertThat(new Version(2, 0).toString()).isEqualTo("2.0");
assertThat(new Version(2, 0, 0).toString()).isEqualTo("2.0");
assertThat(new Version(2, 0, 0, 0).toString()).isEqualTo("2.0");
assertThat(new Version(2, 0, 1).toString()).isEqualTo("2.0.1");
assertThat(new Version(2, 0, 1, 0).toString()).isEqualTo("2.0.1");
assertThat(new Version(2, 0, 0, 1).toString()).isEqualTo("2.0.0.1");
}
@Test // DATACMNS-496
public void parseShouldRemoveNonNumericVersionParts() {
assertThat(Version.parse("2.0.0-rc1"), is(new Version(2, 0, 0)));
assertThat(Version.parse("2.0.0-rc1")).isEqualTo(new Version(2, 0, 0));
}
@Test // DATACMNS-719, DATACMNS-496
public void removesNonNumericSuffix() {
assertThat(Version.parse("4.2.0.RELEASE"), is(new Version(4, 2, 0)));
assertThat(Version.parse("4.2.0.RELEASE")).isEqualTo(new Version(4, 2, 0));
}
@Test // DATACMNS-719, DATACMNS-496