DATAKV-157 - Migrate ticket references in test code to Spring Framework style.
This commit is contained in:
@@ -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,18 +34,12 @@ public class DefaultIdentifierGeneratorUnitTests {
|
||||
|
||||
DefaultIdentifierGenerator generator = DefaultIdentifierGenerator.INSTANCE;
|
||||
|
||||
/**
|
||||
* @DATAKV-136
|
||||
*/
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
public void shouldThrowExceptionForUnsupportedType() {
|
||||
generator.generateIdentifierOfType(ClassTypeInformation.from(Date.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @DATAKV-136
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-136
|
||||
public void shouldGenerateUUIDValueCorrectly() {
|
||||
|
||||
Object value = generator.generateIdentifierOfType(ClassTypeInformation.from(UUID.class));
|
||||
@@ -54,10 +48,7 @@ public class DefaultIdentifierGeneratorUnitTests {
|
||||
assertThat(value, instanceOf(UUID.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @DATAKV-136
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-136
|
||||
public void shouldGenerateStringValueCorrectly() {
|
||||
|
||||
Object value = generator.generateIdentifierOfType(ClassTypeInformation.from(String.class));
|
||||
@@ -66,10 +57,7 @@ public class DefaultIdentifierGeneratorUnitTests {
|
||||
assertThat(value, instanceOf(String.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @DATAKV-136
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-136
|
||||
public void shouldGenerateLongValueCorrectly() {
|
||||
|
||||
Object value = generator.generateIdentifierOfType(ClassTypeInformation.from(Long.class));
|
||||
@@ -78,10 +66,7 @@ public class DefaultIdentifierGeneratorUnitTests {
|
||||
assertThat(value, instanceOf(Long.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @DATAKV-136
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-136
|
||||
public void shouldGenerateIntValueCorrectly() {
|
||||
|
||||
Object value = generator.generateIdentifierOfType(ClassTypeInformation.from(Integer.class));
|
||||
|
||||
@@ -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.
|
||||
@@ -42,10 +42,7 @@ public class ForwardingCloseableIteratorUnitTests<K, V> {
|
||||
@Mock Iterator<Entry<K, V>> iteratorMock;
|
||||
@Mock Runnable closeActionMock;
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
public void hasNextShoudDelegateToWrappedIterator() {
|
||||
|
||||
when(iteratorMock.hasNext()).thenReturn(true);
|
||||
@@ -60,10 +57,7 @@ public class ForwardingCloseableIteratorUnitTests<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
@SuppressWarnings("unchecked")
|
||||
public void nextShoudDelegateToWrappedIterator() {
|
||||
|
||||
@@ -79,10 +73,7 @@ public class ForwardingCloseableIteratorUnitTests<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test(expected = NoSuchElementException.class)
|
||||
@Test(expected = NoSuchElementException.class) // DATAKV-99
|
||||
public void nextShoudThrowErrorWhenWrappedIteratorHasNoMoreElements() {
|
||||
|
||||
when(iteratorMock.next()).thenThrow(new NoSuchElementException());
|
||||
@@ -96,10 +87,7 @@ public class ForwardingCloseableIteratorUnitTests<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
public void closeShouldDoNothingByDefault() {
|
||||
|
||||
new ForwardingCloseableIterator<Entry<K, V>>(iteratorMock).close();
|
||||
@@ -107,10 +95,7 @@ public class ForwardingCloseableIteratorUnitTests<K, V> {
|
||||
verifyZeroInteractions(iteratorMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
public void closeShouldInvokeConfiguredCloseAction() {
|
||||
|
||||
new ForwardingCloseableIterator<Entry<K, V>>(iteratorMock, closeActionMock).close();
|
||||
|
||||
@@ -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,26 +37,17 @@ import org.junit.Test;
|
||||
*/
|
||||
public class IterableConverterUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAKV-101
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-101
|
||||
public void toListShouldReturnEmptyListWhenSourceIsNull() {
|
||||
assertThat(toList(null), notNullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-101
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-101
|
||||
public void toListShouldReturnEmptyListWhenSourceEmpty() {
|
||||
assertThat(toList(Collections.emptySet()), empty());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-101
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-101
|
||||
public void toListShouldReturnSameObjectWhenSourceIsAlreadyListType() {
|
||||
|
||||
List<String> source = new ArrayList<String>();
|
||||
@@ -64,10 +55,7 @@ public class IterableConverterUnitTests {
|
||||
assertThat(toList(source), sameInstance(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-101
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-101
|
||||
public void toListShouldReturnListWhenSourceIsNonListType() {
|
||||
|
||||
Set<String> source = new HashSet<String>();
|
||||
@@ -76,10 +64,7 @@ public class IterableConverterUnitTests {
|
||||
assertThat(toList(source), instanceOf(List.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-101
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-101
|
||||
public void toListShouldHoldValuesInOrderOfSource() {
|
||||
|
||||
Set<String> source = new LinkedHashSet<String>();
|
||||
|
||||
@@ -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.
|
||||
@@ -32,63 +32,42 @@ public class KeyValuePersistenceExceptionTranslatorUnitTests {
|
||||
|
||||
KeyValuePersistenceExceptionTranslator translator = new KeyValuePersistenceExceptionTranslator();
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldReturnDataAccessExceptionWhenGivenOne() {
|
||||
assertThat(translator.translateExceptionIfPossible(new DataRetrievalFailureException("booh")),
|
||||
instanceOf(DataRetrievalFailureException.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldReturnNullWhenGivenNull() {
|
||||
assertThat(translator.translateExceptionIfPossible(null), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldTranslateNoSuchElementExceptionToDataRetrievalFailureException() {
|
||||
assertThat(translator.translateExceptionIfPossible(new NoSuchElementException("")),
|
||||
instanceOf(DataRetrievalFailureException.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldTranslateIndexOutOfBoundsExceptionToDataRetrievalFailureException() {
|
||||
assertThat(translator.translateExceptionIfPossible(new IndexOutOfBoundsException("")),
|
||||
instanceOf(DataRetrievalFailureException.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldTranslateIllegalStateExceptionToDataRetrievalFailureException() {
|
||||
assertThat(translator.translateExceptionIfPossible(new IllegalStateException("")),
|
||||
instanceOf(DataRetrievalFailureException.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldTranslateAnyJavaExceptionToUncategorizedKeyValueException() {
|
||||
assertThat(translator.translateExceptionIfPossible(new UnsupportedOperationException("")),
|
||||
instanceOf(UncategorizedKeyValueException.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void translateExeptionShouldReturnNullForNonJavaExceptions() {
|
||||
assertThat(translator.translateExceptionIfPossible(new NoSuchBeanDefinitionException("")), nullValue());
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -67,54 +67,36 @@ public class KeyValueTemplateTests {
|
||||
this.operations.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldNotThorwErrorWhenExecutedHavingNonExistingIdAndNonNullValue() {
|
||||
operations.insert("1", FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void insertShouldThrowExceptionForNullId() {
|
||||
operations.insert(null, FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void insertShouldThrowExceptionForNullObject() {
|
||||
operations.insert("some-id", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = DuplicateKeyException.class)
|
||||
@Test(expected = DuplicateKeyException.class) // DATACMNS-525
|
||||
public void insertShouldThrowExecptionWhenObjectOfSameTypeAlreadyExists() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
operations.insert("1", FOO_TWO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldWorkCorrectlyWhenObjectsOfDifferentTypesWithSameIdAreInserted() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
operations.insert("1", BAR_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void createShouldReturnSameInstanceGenerateId() {
|
||||
|
||||
ClassWithStringId source = new ClassWithStringId();
|
||||
@@ -123,10 +105,7 @@ public class KeyValueTemplateTests {
|
||||
assertThat(target, sameInstance(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void createShouldRespectExistingId() {
|
||||
|
||||
ClassWithStringId source = new ClassWithStringId();
|
||||
@@ -137,40 +116,28 @@ public class KeyValueTemplateTests {
|
||||
assertThat(operations.findById("one", ClassWithStringId.class), is(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findByIdShouldReturnObjectWithMatchingIdAndType() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
assertThat(operations.findById("1", Foo.class), is(FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findByIdSouldReturnNullIfNoMatchingIdFound() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
assertThat(operations.findById("2", Foo.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findByIdShouldReturnNullIfNoMatchingTypeFound() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
assertThat(operations.findById("1", Bar.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findShouldExecuteQueryCorrectly() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
@@ -181,10 +148,7 @@ public class KeyValueTemplateTests {
|
||||
assertThat(result.get(0), is(FOO_TWO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void readShouldReturnEmptyCollectionIfOffsetOutOfRange() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
@@ -194,10 +158,7 @@ public class KeyValueTemplateTests {
|
||||
assertThat(operations.findInRange(5, 5, Foo.class), emptyIterable());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void updateShouldReplaceExistingObject() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
@@ -205,10 +166,7 @@ public class KeyValueTemplateTests {
|
||||
assertThat(operations.findById("1", Foo.class), is(FOO_TWO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void updateShouldRespectTypeInformation() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
@@ -217,10 +175,7 @@ public class KeyValueTemplateTests {
|
||||
assertThat(operations.findById("1", Foo.class), is(FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteShouldRemoveObjectCorrectly() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
@@ -228,46 +183,31 @@ public class KeyValueTemplateTests {
|
||||
assertThat(operations.findById("1", Foo.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteReturnsNullWhenNotExisting() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
assertThat(operations.delete("2", Foo.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteReturnsRemovedObject() {
|
||||
|
||||
operations.insert("1", FOO_ONE);
|
||||
assertThat(operations.delete("1", Foo.class), is(FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void deleteThrowsExceptionWhenIdCannotBeExctracted() {
|
||||
operations.delete(FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void countShouldReturnZeroWhenNoElementsPresent() {
|
||||
assertThat(operations.count(Foo.class), is(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldRespectTypeAlias() {
|
||||
|
||||
operations.insert("1", ALIASED);
|
||||
|
||||
@@ -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.
|
||||
@@ -86,26 +86,17 @@ public class KeyValueTemplateUnitTests {
|
||||
this.template.setApplicationEventPublisher(publisherMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void shouldThrowExceptionWhenCreatingNewTempateWithNullAdapter() {
|
||||
new KeyValueTemplate(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void shouldThrowExceptionWhenCreatingNewTempateWithNullMappingContext() {
|
||||
new KeyValueTemplate(adapterMock, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldLookUpValuesBeforeInserting() {
|
||||
|
||||
template.insert("1", FOO_ONE);
|
||||
@@ -113,10 +104,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).contains("1", Foo.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldInsertUseClassNameAsDefaultKeyspace() {
|
||||
|
||||
template.insert("1", FOO_ONE);
|
||||
@@ -124,10 +112,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).put("1", FOO_ONE, Foo.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldThrowExceptionWhenObectWithIdAlreadyExists() {
|
||||
|
||||
exception.expect(DuplicateKeyException.class);
|
||||
@@ -138,26 +123,17 @@ public class KeyValueTemplateUnitTests {
|
||||
template.insert("1", FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void insertShouldThrowExceptionForNullId() {
|
||||
template.insert(null, FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void insertShouldThrowExceptionForNullObject() {
|
||||
template.insert("some-id", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldGenerateId() {
|
||||
|
||||
ClassWithStringId target = template.insert(new ClassWithStringId());
|
||||
@@ -165,18 +141,12 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(target.id, notNullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void insertShouldThrowErrorWhenIdCannotBeResolved() {
|
||||
template.insert(FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldReturnSameInstanceGenerateId() {
|
||||
|
||||
ClassWithStringId source = new ClassWithStringId();
|
||||
@@ -185,10 +155,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(target, sameInstance(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldRespectExistingId() {
|
||||
|
||||
ClassWithStringId source = new ClassWithStringId();
|
||||
@@ -199,18 +166,12 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).put("one", source, ClassWithStringId.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findByIdShouldReturnNullWhenNoElementsPresent() {
|
||||
assertNull(template.findById("1", Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findByIdShouldReturnObjectWithMatchingIdAndType() {
|
||||
|
||||
template.findById("1", Foo.class);
|
||||
@@ -218,18 +179,12 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).get("1", Foo.class.getName(), Foo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void findByIdShouldThrowExceptionWhenGivenNullId() {
|
||||
template.findById((Serializable) null, Foo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllOfShouldReturnEntireCollection() {
|
||||
|
||||
template.findAll(Foo.class);
|
||||
@@ -237,18 +192,12 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).getAllOf(Foo.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void findAllOfShouldThrowExceptionWhenGivenNullType() {
|
||||
template.findAll(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findShouldCallFindOnAdapterToResolveMatching() {
|
||||
|
||||
template.find(STRING_QUERY, Foo.class);
|
||||
@@ -256,10 +205,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).find(STRING_QUERY, Foo.class.getName(), Foo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void findInRangeShouldRespectOffset() {
|
||||
|
||||
@@ -273,10 +219,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getCritieria(), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void updateShouldReplaceExistingObject() {
|
||||
|
||||
template.update("1", FOO_TWO);
|
||||
@@ -284,26 +227,17 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).put("1", FOO_TWO, Foo.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void updateShouldThrowExceptionWhenGivenNullId() {
|
||||
template.update(null, FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void updateShouldThrowExceptionWhenGivenNullObject() {
|
||||
template.update("1", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void updateShouldUseExtractedIdInformation() {
|
||||
|
||||
ClassWithStringId source = new ClassWithStringId();
|
||||
@@ -314,18 +248,12 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).put(source.id, source, ClassWithStringId.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class) // DATACMNS-525
|
||||
public void updateShouldThrowErrorWhenIdInformationCannotBeExtracted() {
|
||||
template.update(FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteShouldRemoveObjectCorrectly() {
|
||||
|
||||
template.delete("1", Foo.class);
|
||||
@@ -333,10 +261,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).delete("1", Foo.class.getName(), Foo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteRemovesObjectUsingExtractedId() {
|
||||
|
||||
ClassWithStringId source = new ClassWithStringId();
|
||||
@@ -347,26 +272,17 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).delete("some-id", ClassWithStringId.class.getName(), ClassWithStringId.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void deleteThrowsExceptionWhenIdCannotBeExctracted() {
|
||||
template.delete(FOO_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void countShouldReturnZeroWhenNoElementsPresent() {
|
||||
template.count(Foo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void countShouldReturnCollectionSize() {
|
||||
|
||||
when(adapterMock.count(Foo.class.getName())).thenReturn(2L);
|
||||
@@ -374,18 +290,12 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(template.count(Foo.class), is(2L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void countShouldThrowErrorOnNullType() {
|
||||
template.count(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldRespectTypeAlias() {
|
||||
|
||||
template.insert("1", ALIASED);
|
||||
@@ -393,10 +303,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).put("1", ALIASED, "aliased");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertShouldRespectTypeAliasOnSubClass() {
|
||||
|
||||
template.insert("1", SUBCLASS_OF_ALIASED);
|
||||
@@ -404,11 +311,8 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(adapterMock, times(1)).put("1", SUBCLASS_OF_ALIASED, "aliased");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllOfShouldRespectTypeAliasAndFilterNonMatchingTypes() {
|
||||
|
||||
Collection foo = Arrays.asList(ALIASED, SUBCLASS_OF_ALIASED);
|
||||
@@ -417,28 +321,19 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(template.findAll(SUBCLASS_OF_ALIASED.getClass()), containsInAnyOrder(SUBCLASS_OF_ALIASED));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void insertSouldRespectTypeAliasAndFilterNonMatching() {
|
||||
|
||||
template.insert("1", ALIASED);
|
||||
assertThat(template.findById("1", SUBCLASS_OF_ALIASED.getClass()), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void setttingNullPersistenceExceptionTranslatorShouldThrowException() {
|
||||
template.setExceptionTranslator(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91
|
||||
public void shouldNotPublishEventWhenNoApplicationContextSet() {
|
||||
|
||||
template.setApplicationEventPublisher(null);
|
||||
@@ -448,10 +343,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verifyZeroInteractions(publisherMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-104
|
||||
public void shouldNotPublishEventsWhenEventsToPublishIsSetToNull() {
|
||||
|
||||
template.setEventTypesToPublish(null);
|
||||
@@ -461,10 +353,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verifyZeroInteractions(publisherMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-104
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void shouldNotPublishEventsWhenEventsToPublishIsSetToEmptyList() {
|
||||
|
||||
@@ -475,10 +364,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verifyZeroInteractions(publisherMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-104
|
||||
public void shouldPublishEventsByDefault() {
|
||||
|
||||
template.insert("1", FOO_ONE);
|
||||
@@ -486,11 +372,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verify(publisherMock, atLeastOnce()).publishEvent(Matchers.any(KeyValueEvent.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "unchecked", })
|
||||
public void shouldNotPublishEventWhenNotExplicitlySetForPublication() {
|
||||
|
||||
@@ -501,11 +383,7 @@ public class KeyValueTemplateUnitTests {
|
||||
verifyZeroInteractions(publisherMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldPublishBeforeInsertEventCorrectly() {
|
||||
|
||||
@@ -523,11 +401,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getPayload(), is((Object) FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldPublishAfterInsertEventCorrectly() {
|
||||
|
||||
@@ -545,11 +419,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getPayload(), is((Object) FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldPublishBeforeUpdateEventCorrectly() {
|
||||
|
||||
@@ -567,11 +437,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getPayload(), is((Object) FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldPublishAfterUpdateEventCorrectly() {
|
||||
|
||||
@@ -589,11 +455,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getPayload(), is((Object) FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void shouldPublishBeforeDeleteEventCorrectly() {
|
||||
|
||||
@@ -610,11 +472,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getKeyspace(), is(Foo.class.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void shouldPublishAfterDeleteEventCorrectly() {
|
||||
|
||||
@@ -633,11 +491,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getPayload(), is((Object) FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void shouldPublishBeforeGetEventCorrectly() {
|
||||
|
||||
@@ -656,11 +510,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getKeyspace(), is(Foo.class.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void shouldPublishAfterGetEventCorrectly() {
|
||||
|
||||
@@ -680,11 +530,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getPayload(), is((Object) FOO_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-91
|
||||
* @see DATAKV-104
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-91, DATAKV-104
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void shouldPublishDropKeyspaceEventCorrectly() {
|
||||
|
||||
@@ -700,10 +546,7 @@ public class KeyValueTemplateUnitTests {
|
||||
assertThat(captor.getValue().getKeyspace(), is(Foo.class.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-129
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-129
|
||||
public void insertShouldRespectTypeAliasUsingAliasFor() {
|
||||
|
||||
template.insert("1", ALIASED_USING_ALIAS_FOR);
|
||||
|
||||
@@ -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,50 +40,35 @@ public class SpelPropertyComperatorUnitTests {
|
||||
private static final WrapperType WRAPPER_ONE = new WrapperType("w-one", ONE);
|
||||
private static final WrapperType WRAPPER_TWO = new WrapperType("w-two", TWO);
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldCompareStringAscCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("stringProperty", PARSER);
|
||||
assertThat(comparator.compare(ONE, TWO), is(ONE.getStringProperty().compareTo(TWO.getStringProperty())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldCompareStringDescCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("stringProperty", PARSER).desc();
|
||||
assertThat(comparator.compare(ONE, TWO), is(TWO.getStringProperty().compareTo(ONE.getStringProperty())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldCompareIntegerAscCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("integerProperty", PARSER);
|
||||
assertThat(comparator.compare(ONE, TWO), is(ONE.getIntegerProperty().compareTo(TWO.getIntegerProperty())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldCompareIntegerDescCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("integerProperty", PARSER).desc();
|
||||
assertThat(comparator.compare(ONE, TWO), is(TWO.getIntegerProperty().compareTo(ONE.getIntegerProperty())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldComparePrimitiveIntegerAscCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("primitiveProperty", PARSER);
|
||||
@@ -91,20 +76,14 @@ public class SpelPropertyComperatorUnitTests {
|
||||
is(valueOf(ONE.getPrimitiveProperty()).compareTo(valueOf(TWO.getPrimitiveProperty()))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldNotFailOnNullValues() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("stringProperty", PARSER);
|
||||
assertThat(comparator.compare(ONE, new SomeType(null, null, 2)), is(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldComparePrimitiveIntegerDescCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("primitiveProperty", PARSER).desc();
|
||||
@@ -112,29 +91,20 @@ public class SpelPropertyComperatorUnitTests {
|
||||
is(valueOf(TWO.getPrimitiveProperty()).compareTo(valueOf(ONE.getPrimitiveProperty()))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldSortNullsFirstCorrectly() {
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("stringProperty", PARSER).nullsFirst();
|
||||
assertThat(comparator.compare(ONE, new SomeType(null, null, 2)), equalTo(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldSortNullsLastCorrectly() {
|
||||
|
||||
Comparator<SomeType> comparator = new SpelPropertyComparator<SomeType>("stringProperty", PARSER).nullsLast();
|
||||
assertThat(comparator.compare(ONE, new SomeType(null, null, 2)), equalTo(-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldCompareNestedTypesCorrectly() {
|
||||
|
||||
Comparator<WrapperType> comparator = new SpelPropertyComparator<WrapperType>("nestedType.stringProperty", PARSER);
|
||||
@@ -142,10 +112,7 @@ public class SpelPropertyComperatorUnitTests {
|
||||
.compareTo(WRAPPER_TWO.getNestedType().getStringProperty())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldCompareNestedTypesCorrectlyWhenOneOfThemHasNullValue() {
|
||||
|
||||
SpelPropertyComparator<WrapperType> comparator = new SpelPropertyComparator<WrapperType>(
|
||||
|
||||
@@ -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.
|
||||
@@ -65,10 +65,7 @@ public class SpelQueryEngineUnitTests {
|
||||
engine.registerAdapter(adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-114
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-114
|
||||
@SuppressWarnings("unchecked")
|
||||
public void queriesEntitiesWithNullProperty() throws Exception {
|
||||
|
||||
@@ -78,10 +75,7 @@ public class SpelQueryEngineUnitTests {
|
||||
-1, anyString()), contains(BOB_WITH_FIRSTNAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-114
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-114
|
||||
public void countsEntitiesWithNullProperty() throws Exception {
|
||||
|
||||
doReturn(people).when(adapter).getAllOf(anyString());
|
||||
|
||||
@@ -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.
|
||||
@@ -47,74 +47,47 @@ public class AnnotationBasedKeySpaceResolverUnitTests {
|
||||
resolver = AnnotationBasedKeySpaceResolver.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldResolveKeySpaceDefaultValueCorrectly() {
|
||||
assertThat(resolver.resolveKeySpace(EntityWithDefaultKeySpace.class), is("daenerys"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldResolveKeySpaceCorrectly() {
|
||||
assertThat(resolver.resolveKeySpace(EntityWithSetKeySpace.class), is("viserys"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-105
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-105
|
||||
public void shouldReturnNullWhenNoKeySpaceFoundOnComposedPersistentAnnotation() {
|
||||
assertThat(resolver.resolveKeySpace(TypeWithInhteritedPersistentAnnotationNotHavingKeySpace.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-105
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-105
|
||||
public void shouldReturnNullWhenPersistentIsFoundOnNonComposedAnnotation() {
|
||||
assertThat(resolver.resolveKeySpace(TypeWithPersistentAnnotationNotHavingKeySpace.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-105
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-105
|
||||
public void shouldReturnNullWhenPersistentIsNotFound() {
|
||||
assertThat(resolver.resolveKeySpace(TypeWithoutKeySpace.class), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldResolveInheritedKeySpaceCorrectly() {
|
||||
assertThat(resolver.resolveKeySpace(EntityWithInheritedKeySpace.class), is("viserys"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldResolveDirectKeySpaceAnnotationCorrectly() {
|
||||
assertThat(resolver.resolveKeySpace(TypeWithDirectKeySpaceAnnotation.class), is("rhaegar"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-129
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-129
|
||||
public void shouldResolveKeySpaceUsingAliasForCorrectly() {
|
||||
assertThat(resolver.resolveKeySpace(EntityWithSetKeySpaceUsingAliasFor.class), is("viserys"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-129
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-129
|
||||
public void shouldResolveKeySpaceUsingAliasForCorrectlyOnSubClass() {
|
||||
assertThat(resolver.resolveKeySpace(EntityWithInheritedKeySpaceUsingAliasFor.class), is("viserys"));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -50,10 +50,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
repo = new SimpleKeyValueRepository<Foo, String>(ei, opsMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void saveNewWithNumericId() {
|
||||
|
||||
ReflectionEntityInformation<WithNumericId, Integer> ei = new ReflectionEntityInformation<WithNumericId, Integer>(
|
||||
@@ -67,10 +64,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).insert(eq(withNumericId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void testDoubleSave() {
|
||||
|
||||
Foo foo = new Foo("one");
|
||||
@@ -83,10 +77,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).update(eq(foo.getId()), eq(foo));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void multipleSave() {
|
||||
|
||||
Foo one = new Foo("one");
|
||||
@@ -97,10 +88,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).insert(eq(two));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteEntity() {
|
||||
|
||||
Foo one = repo.save(new Foo("one"));
|
||||
@@ -109,10 +97,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).delete(eq(one.getId()), eq(Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteById() {
|
||||
|
||||
repo.delete("one");
|
||||
@@ -120,10 +105,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).delete(eq("one"), eq(Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteAll() {
|
||||
|
||||
repo.deleteAll();
|
||||
@@ -131,10 +113,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).delete(eq(Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllIds() {
|
||||
|
||||
repo.findAll(Arrays.asList("one", "two", "three"));
|
||||
@@ -142,10 +121,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(3)).findById(anyString(), eq(Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllWithPageableShouldDelegateToOperationsCorrectlyWhenPageableDoesNotContainSort() {
|
||||
|
||||
repo.findAll(new PageRequest(10, 15));
|
||||
@@ -153,10 +129,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).findInRange(eq(150), eq(15), isNull(Sort.class), eq(Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllWithPageableShouldDelegateToOperationsCorrectlyWhenPageableContainsSort() {
|
||||
|
||||
Sort sort = new Sort("for", "bar");
|
||||
@@ -165,10 +138,7 @@ public class SimpleKeyValueRepositoryUnitTests {
|
||||
verify(opsMock, times(1)).findInRange(eq(150), eq(15), eq(sort), eq(Foo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllShouldFallbackToFindAllOfWhenGivenNullPageable() {
|
||||
|
||||
repo.findAll((Pageable) null);
|
||||
|
||||
@@ -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 CachingKeyValuePartTreeQueryUnitTests {
|
||||
when(metadataMock.getReturnedDomainClass(any(Method.class))).thenReturn((Class) Person.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-137
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-137
|
||||
public void cachedSpelExpressionShouldBeReusedWithNewContext() throws NoSuchMethodException, SecurityException {
|
||||
|
||||
QueryMethod qm = new QueryMethod(Repo.class.getMethod("findByFirstname", String.class), metadataMock,
|
||||
|
||||
@@ -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 KeyValuePartTreeQueryUnitTests {
|
||||
@Mock RepositoryMetadata metadataMock;
|
||||
@Mock ProjectionFactory projectionFactoryMock;
|
||||
|
||||
/**
|
||||
* @see DATAKV-115
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-115
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void spelExpressionAndContextShouldNotBeReused() throws NoSuchMethodException, SecurityException {
|
||||
|
||||
@@ -76,10 +73,7 @@ public class KeyValuePartTreeQueryUnitTests {
|
||||
assertThat(first, not(sameInstance(second)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-142
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-142
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldApplyPageableParameterToCollectionQuery() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
@@ -98,10 +92,7 @@ public class KeyValuePartTreeQueryUnitTests {
|
||||
assertThat(query.getRows(), is(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-142
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-142
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldApplyDerivedMaxResultsToQuery() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
@@ -118,10 +109,7 @@ public class KeyValuePartTreeQueryUnitTests {
|
||||
assertThat(query.getRows(), is(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-142
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-142
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldApplyDerivedMaxResultsToQueryWithParameters() throws SecurityException, NoSuchMethodException {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -60,322 +60,202 @@ public class SpelQueryCreatorUnitTests {
|
||||
|
||||
@Mock RepositoryMetadata metadataMock;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void equalsReturnsTrueWhenMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstname", BRAN.firstname).against(BRAN), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void equalsReturnsFalseWhenNotMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstname", BRAN.firstname).against(RICKON), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isTrueAssertedPropertlyWhenTrue() throws Exception {
|
||||
assertThat(evaluate("findBySkinChangerIsTrue").against(BRAN), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isTrueAssertedPropertlyWhenFalse() throws Exception {
|
||||
assertThat(evaluate("findBySkinChangerIsTrue").against(RICKON), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isFalseAssertedPropertlyWhenTrue() throws Exception {
|
||||
assertThat(evaluate("findBySkinChangerIsFalse").against(BRAN), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isFalseAssertedPropertlyWhenFalse() throws Exception {
|
||||
assertThat(evaluate("findBySkinChangerIsFalse").against(RICKON), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isNullAssertedPropertlyWhenAttributeIsNull() throws Exception {
|
||||
assertThat(evaluate("findByLastnameIsNull").against(BRAN), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isNullAssertedPropertlyWhenAttributeIsNotNull() throws Exception {
|
||||
assertThat(evaluate("findByLastnameIsNull").against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isNotNullFalseTrueWhenAttributeIsNull() throws Exception {
|
||||
assertThat(evaluate("findByLastnameIsNotNull").against(BRAN), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void isNotNullReturnsTrueAttributeIsNotNull() throws Exception {
|
||||
assertThat(evaluate("findByLastnameIsNotNull").against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void startsWithReturnsTrueWhenMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameStartingWith", "r").against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void startsWithReturnsFalseWhenNotMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameStartingWith", "r").against(BRAN), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void likeReturnsTrueWhenMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameLike", "ob").against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void likeReturnsFalseWhenNotMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameLike", "ra").against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void endsWithReturnsTrueWhenMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameEndingWith", "bb").against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void endsWithReturnsFalseWhenNotMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameEndingWith", "an").against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class) // DATACMNS-525
|
||||
public void startsWithIgnoreCaseReturnsTrueWhenMatching() throws Exception {
|
||||
assertThat(evaluate("findByFirstnameIgnoreCase", "R").against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void greaterThanReturnsTrueForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThan", BRAN.age).against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void greaterThanReturnsFalseForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThan", BRAN.age).against(RICKON), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void afterReturnsTrueForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByBirthdayAfter", ROBB.birthday).against(BRAN), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void afterReturnsFalseForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByBirthdayAfter", BRAN.birthday).against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void greaterThanEaualsReturnsTrueForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanEqual", BRAN.age).against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void greaterThanEqualsReturnsTrueForEqualValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanEqual", BRAN.age).against(BRAN), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void greaterThanEqualsReturnsFalseForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanEqual", BRAN.age).against(RICKON), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void lessThanReturnsTrueForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeLessThan", BRAN.age).against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void lessThanReturnsFalseForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeLessThan", BRAN.age).against(RICKON), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void beforeReturnsTrueForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByBirthdayBefore", BRAN.birthday).against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void beforeReturnsFalseForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByBirthdayBefore", ROBB.birthday).against(BRAN), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void lessThanEaualsReturnsTrueForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeLessThanEqual", BRAN.age).against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void lessThanEaualsReturnsTrueForEqualValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeLessThanEqual", BRAN.age).against(BRAN), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void lessThanEqualsReturnsFalseForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeLessThanEqual", BRAN.age).against(RICKON), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void betweenEqualsReturnsTrueForValuesInBetween() throws Exception {
|
||||
assertThat(evaluate("findByAgeBetween", BRAN.age, ROBB.age).against(ARYA), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void betweenEqualsReturnsFalseForHigherValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeBetween", BRAN.age, ROBB.age).against(JON), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void betweenEqualsReturnsFalseForLowerValues() throws Exception {
|
||||
assertThat(evaluate("findByAgeBetween", BRAN.age, ROBB.age).against(RICKON), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void connectByAndReturnsTrueWhenAllPropertiesMatching() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanAndLastname", BRAN.age, JON.lastname).against(JON), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void connectByAndReturnsFalseWhenOnlyFewPropertiesMatch() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanAndLastname", BRAN.age, JON.lastname).against(ROBB), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void connectByOrReturnsTrueWhenOnlyFewPropertiesMatch() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanOrLastname", BRAN.age, JON.lastname).against(ROBB), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void connectByOrReturnsTrueWhenAllPropertiesMatch() throws Exception {
|
||||
assertThat(evaluate("findByAgeGreaterThanOrLastname", BRAN.age, JON.lastname).against(JON), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void regexReturnsTrueWhenMatching() throws Exception {
|
||||
assertThat(evaluate("findByLastnameMatches", "^s.*w$").against(JON), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void regexReturnsFalseWhenNotMatching() throws Exception {
|
||||
assertThat(evaluate("findByLastnameMatches", "^s.*w$").against(ROBB), is(false));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -52,26 +52,17 @@ public class KeyValueQuerydslUtilsUnitTests {
|
||||
this.builder = new PathBuilder<Person>(path.getType(), path.getMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void toOrderSpecifierThrowsExceptioOnNullPathBuilder() {
|
||||
toOrderSpecifier(new Sort("firstname"), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void toOrderSpecifierReturnsEmptyArrayWhenSortIsNull() {
|
||||
assertThat(toOrderSpecifier(null, builder), arrayWithSize(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void toOrderSpecifierConvertsSimpleAscSortCorrectly() {
|
||||
|
||||
Sort sort = new Sort(Direction.ASC, "firstname");
|
||||
@@ -82,10 +73,7 @@ public class KeyValueQuerydslUtilsUnitTests {
|
||||
IsArrayContainingInOrder.<OrderSpecifier<?>> arrayContaining(QPerson.person.firstname.asc()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void toOrderSpecifierConvertsSimpleDescSortCorrectly() {
|
||||
|
||||
Sort sort = new Sort(Direction.DESC, "firstname");
|
||||
@@ -96,10 +84,7 @@ public class KeyValueQuerydslUtilsUnitTests {
|
||||
IsArrayContainingInOrder.<OrderSpecifier<?>> arrayContaining(QPerson.person.firstname.desc()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void toOrderSpecifierConvertsSortCorrectlyAndRetainsArgumentOrder() {
|
||||
|
||||
Sort sort = new Sort(Direction.DESC, "firstname").and(new Sort(Direction.ASC, "age"));
|
||||
@@ -110,10 +95,7 @@ public class KeyValueQuerydslUtilsUnitTests {
|
||||
QPerson.person.age.asc()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void toOrderSpecifierConvertsSortWithNullHandlingCorrectly() {
|
||||
|
||||
Sort sort = new Sort(new Sort.Order(Direction.DESC, "firstname", NullHandling.NULLS_LAST));
|
||||
|
||||
@@ -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.
|
||||
@@ -48,35 +48,23 @@ public class KeyValueRepositoryFactoryBeanUnitTests {
|
||||
SampleRepository.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-123
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAKV-123
|
||||
public void rejectsNullKeyValueOperations() {
|
||||
factoryBean.setKeyValueOperations(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-123
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAKV-123
|
||||
public void rejectsNullQueryCreator() {
|
||||
factoryBean.setQueryCreator(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-123
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAKV-123
|
||||
public void rejectsUninitializedInstance() {
|
||||
factoryBean.afterPropertiesSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-123
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAKV-123
|
||||
public void rejectsInstanceWithoutKeyValueOperations() {
|
||||
|
||||
Class<? extends AbstractQueryCreator<?, ?>> creatorType = (Class<? extends AbstractQueryCreator<?, ?>>) mock(
|
||||
@@ -86,20 +74,14 @@ public class KeyValueRepositoryFactoryBeanUnitTests {
|
||||
factoryBean.afterPropertiesSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-123
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAKV-123
|
||||
public void rejectsInstanceWithoutQueryCreator() {
|
||||
|
||||
factoryBean.setKeyValueOperations(mock(KeyValueOperations.class));
|
||||
factoryBean.afterPropertiesSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-123
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-123
|
||||
@SuppressWarnings("unchecked")
|
||||
public void createsRepositoryFactory() {
|
||||
|
||||
@@ -115,10 +97,7 @@ public class KeyValueRepositoryFactoryBeanUnitTests {
|
||||
assertThat(factoryBean.createRepositoryFactory(), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-112
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAKV-112
|
||||
public void rejectsNullQueryType() {
|
||||
factoryBean.setQueryType(null);
|
||||
}
|
||||
|
||||
@@ -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 abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
this.repository = getRepository(keyValueRepositoryFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findBy() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -78,10 +75,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(repository.findByAge(19), hasItems(CERSEI, JAIME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-137
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-137
|
||||
public void findByFirstname() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -90,11 +84,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(repository.findByFirstname(JAIME.getFirstname()), hasItems(JAIME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
* @see DATAKV-137
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525, DATAKV-137
|
||||
public void combindedFindUsingAnd() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -103,10 +93,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(repository.findByFirstnameAndAge(TYRION.getFirstname(), 17), hasItem(TYRION));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findPage() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -122,10 +109,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(next.getContent(), IsCollectionWithSize.hasSize(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findByConnectingOr() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -133,11 +117,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(repository.findByAgeOrFirstname(19, TYRION.getFirstname()), hasItems(CERSEI, JAIME, TYRION));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
* @see DATAKV-137
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525, DATAKV-137
|
||||
public void singleEntityExecution() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -146,10 +126,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(repository.findByAgeAndFirstname(CERSEI.getAge(), CERSEI.getFirstname()), is(CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllShouldRespectSort() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -159,10 +136,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
contains(TYRION, JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void derivedFinderShouldRespectSort() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -172,10 +146,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(result, contains(TYRION, JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-121
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-121
|
||||
public void projectsResultToInterface() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -186,10 +157,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
|
||||
assertThat(result.get(0).getFirstname(), is(CERSEI.getFirstname()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-121
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-121
|
||||
public void projectsResultToDynamicInterface() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
|
||||
@@ -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.
|
||||
@@ -49,112 +49,73 @@ public class MapKeyValueAdapterUnitTests {
|
||||
this.adapter = new MapKeyValueAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void putShouldThrowExceptionWhenAddingNullId() {
|
||||
adapter.put(null, object1, COLLECTION_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void putShouldThrowExceptionWhenCollectionIsNullValue() {
|
||||
adapter.put("1", object1, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void putReturnsNullWhenNoObjectForIdPresent() {
|
||||
assertThat(adapter.put("1", object1, COLLECTION_1), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void putShouldReturnPreviousObjectForIdWhenAddingNewOneWithSameIdPresent() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
assertThat(adapter.put("1", object2, COLLECTION_1), equalTo(object1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void containsShouldThrowExceptionWhenIdIsNull() {
|
||||
adapter.contains(null, COLLECTION_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void containsShouldThrowExceptionWhenTypeIsNull() {
|
||||
adapter.contains("", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void containsShouldReturnFalseWhenNoElementsPresent() {
|
||||
assertThat(adapter.contains("1", COLLECTION_1), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void containShouldReturnTrueWhenElementWithIdPresent() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
assertThat(adapter.contains("1", COLLECTION_1), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void getShouldReturnNullWhenNoElementWithIdPresent() {
|
||||
assertThat(adapter.get("1", COLLECTION_1), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void getShouldReturnElementWhenMatchingIdPresent() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
assertThat(adapter.get("1", COLLECTION_1), is(object1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void getShouldThrowExceptionWhenIdIsNull() {
|
||||
adapter.get(null, COLLECTION_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void getShouldThrowExceptionWhenTypeIsNull() {
|
||||
adapter.get("1", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void getAllOfShouldReturnAllValuesOfGivenCollection() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
@@ -164,36 +125,24 @@ public class MapKeyValueAdapterUnitTests {
|
||||
assertThat(adapter.getAllOf(COLLECTION_1), containsInAnyOrder(object1, object2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-525
|
||||
public void getAllOfShouldThrowExceptionWhenTypeIsNull() {
|
||||
adapter.getAllOf(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteShouldReturnNullWhenGivenIdThatDoesNotExist() {
|
||||
assertThat(adapter.delete("1", COLLECTION_1), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void deleteShouldReturnDeletedObject() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
assertThat(adapter.delete("1", COLLECTION_1), is(object1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
public void scanShouldIterateOverAvailableEntries() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
@@ -206,18 +155,12 @@ public class MapKeyValueAdapterUnitTests {
|
||||
assertThat(iterator.hasNext(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
public void scanShouldReturnEmptyIteratorWhenNoElementsAvailable() {
|
||||
assertThat(adapter.entries(COLLECTION_1).hasNext(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-99
|
||||
public void scanDoesNotMixResultsFromMultipleKeyspaces() {
|
||||
|
||||
adapter.put("1", object1, COLLECTION_1);
|
||||
|
||||
@@ -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.
|
||||
@@ -44,10 +44,7 @@ import com.google.common.collect.Lists;
|
||||
*/
|
||||
public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitTests<QPersonRepository> {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findOneIsExecutedCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -56,10 +53,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, is(CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllIsExecutedCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -68,10 +62,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, containsInAnyOrder(CERSEI, JAIME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findWithPaginationWorksCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -89,10 +80,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(page2.hasNext(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllUsingOrderSpecifierWorksCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -103,10 +91,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, contains(JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllUsingPageableWithSortWorksCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -117,10 +102,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, contains(JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void findAllUsingPagableWithQSortWorksCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -131,10 +113,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, contains(JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-90
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-90
|
||||
public void findAllWithOrderSpecifierWorksCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -144,10 +123,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, contains(TYRION, JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-90
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-90
|
||||
public void findAllShouldIgnoreNullOrderSpecifier() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -157,10 +133,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(result, containsInAnyOrder(TYRION, JAIME, CERSEI));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-95
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-95
|
||||
public void executesExistsCorrectly() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
@@ -168,10 +141,7 @@ public class QuerydslKeyValueRepositoryUnitTests extends AbstractRepositoryUnitT
|
||||
assertThat(repository.exists(QPerson.person.age.eq(CERSEI.getAge())), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-96
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-96
|
||||
public void shouldSupportFindAllWithPredicateAndSort() {
|
||||
|
||||
repository.save(LENNISTERS);
|
||||
|
||||
@@ -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 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
*/
|
||||
public class MapRepositoriesConfigurationExtensionIntegrationTests {
|
||||
|
||||
/**
|
||||
* @see DATAKV-86
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-86
|
||||
public void registersDefaultTemplateIfReferenceNotCustomized() {
|
||||
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
|
||||
@@ -53,10 +50,7 @@ public class MapRepositoriesConfigurationExtensionIntegrationTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-86
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-86
|
||||
public void doesNotRegisterDefaulttemplateIfReferenceIsCustomized() {
|
||||
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
|
||||
@@ -67,19 +61,13 @@ public class MapRepositoriesConfigurationExtensionIntegrationTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-87
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-87
|
||||
public void considersMapTypeConfiguredOnAnnotation() {
|
||||
assertKeyValueTemplateWithAdapterFor(ConcurrentSkipListMap.class, new AnnotationConfigApplicationContext(
|
||||
ConfigWithCustomizedMapType.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAKV-87
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-87
|
||||
public void doesNotConsiderMapConfiguredIfTemplateIsPresent() {
|
||||
assertKeyValueTemplateWithAdapterFor(ConcurrentHashMap.class, new AnnotationConfigApplicationContext(
|
||||
ConfigWithCustomizedMapTypeAndExplicitDefinitionOfKeyValueTemplate.class));
|
||||
|
||||
@@ -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.
|
||||
@@ -46,10 +46,7 @@ public class MapRepositoryRegistrarWithFullDefaultingIntegrationTests {
|
||||
|
||||
@Autowired PersonRepository repo;
|
||||
|
||||
/**
|
||||
* @see DATAKV-86
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAKV-86
|
||||
public void shouldEnableMapRepositoryCorrectly() {
|
||||
assertThat(repo, notNullValue());
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -54,10 +54,7 @@ public class MapRepositoryRegistrarWithTemplateDefinitionIntegrationTests {
|
||||
|
||||
@Autowired PersonRepository repo;
|
||||
|
||||
/**
|
||||
* @see DATACMNS-525
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-525
|
||||
public void shouldEnableMapRepositoryCorrectly() {
|
||||
assertThat(repo, notNullValue());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user