Update spring-javaformat to 0.0.39
Closes gh-2528
This commit is contained in:
@@ -89,7 +89,7 @@ public class JacksonMongoSessionConverterTest extends AbstractMongoSessionConver
|
||||
void shouldNotAllowNullObjectMapperToBeInjected() {
|
||||
|
||||
Assertions.assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new JacksonMongoSessionConverter((ObjectMapper) null));
|
||||
.isThrownBy(() -> new JacksonMongoSessionConverter((ObjectMapper) null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -43,14 +43,14 @@ public class JdkMongoSessionConverterTest extends AbstractMongoSessionConverterT
|
||||
|
||||
@Test
|
||||
void constructorNullSerializer() {
|
||||
assertThatIllegalArgumentException().isThrownBy(
|
||||
() -> new JdkMongoSessionConverter(null, new DeserializingConverter(), this.inactiveInterval));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new JdkMongoSessionConverter(null, new DeserializingConverter(), this.inactiveInterval));
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructorNullDeserializer() {
|
||||
assertThatIllegalArgumentException().isThrownBy(
|
||||
() -> new JdkMongoSessionConverter(new SerializingConverter(), null, this.inactiveInterval));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new JdkMongoSessionConverter(new SerializingConverter(), null, this.inactiveInterval));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class MongoIndexedSessionRepositoryTest {
|
||||
// then
|
||||
assertThat(session.getId()).isNotEmpty();
|
||||
assertThat(session.getMaxInactiveInterval().getSeconds())
|
||||
.isEqualTo(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
|
||||
.isEqualTo(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,7 +88,8 @@ public class MongoIndexedSessionRepositoryTest {
|
||||
BasicDBObject dbSession = new BasicDBObject();
|
||||
|
||||
given(this.converter.convert(session, TypeDescriptor.valueOf(MongoSession.class),
|
||||
TypeDescriptor.valueOf(DBObject.class))).willReturn(dbSession);
|
||||
TypeDescriptor.valueOf(DBObject.class)))
|
||||
.willReturn(dbSession);
|
||||
// when
|
||||
this.repository.save(session);
|
||||
|
||||
@@ -104,12 +105,14 @@ public class MongoIndexedSessionRepositoryTest {
|
||||
Document sessionDocument = new Document();
|
||||
|
||||
given(this.mongoOperations.findById(sessionId, Document.class,
|
||||
MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME)).willReturn(sessionDocument);
|
||||
MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME))
|
||||
.willReturn(sessionDocument);
|
||||
|
||||
MongoSession session = new MongoSession();
|
||||
|
||||
given(this.converter.convert(sessionDocument, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(session);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(session);
|
||||
|
||||
// when
|
||||
MongoSession retrievedSession = this.repository.findById(sessionId);
|
||||
@@ -126,13 +129,15 @@ public class MongoIndexedSessionRepositoryTest {
|
||||
Document sessionDocument = new Document();
|
||||
|
||||
given(this.mongoOperations.findById(sessionId, Document.class,
|
||||
MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME)).willReturn(sessionDocument);
|
||||
MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME))
|
||||
.willReturn(sessionDocument);
|
||||
|
||||
MongoSession session = mock(MongoSession.class);
|
||||
|
||||
given(session.isExpired()).willReturn(true);
|
||||
given(this.converter.convert(sessionDocument, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(session);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(session);
|
||||
given(session.getId()).willReturn("sessionId");
|
||||
|
||||
// when
|
||||
@@ -155,9 +160,11 @@ public class MongoIndexedSessionRepositoryTest {
|
||||
MongoSession mongoSession = new MongoSession(sessionId, MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
|
||||
|
||||
given(this.converter.convert(sessionDocument, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(mongoSession);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(mongoSession);
|
||||
given(this.mongoOperations.findById(eq(sessionId), eq(Document.class),
|
||||
eq(MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME))).willReturn(sessionDocument);
|
||||
eq(MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME)))
|
||||
.willReturn(sessionDocument);
|
||||
|
||||
// when
|
||||
this.repository.deleteById(sessionId);
|
||||
@@ -178,14 +185,15 @@ public class MongoIndexedSessionRepositoryTest {
|
||||
given(this.converter.getQueryForIndex(anyString(), any(Object.class))).willReturn(mock(Query.class));
|
||||
given(this.mongoOperations.find(any(Query.class), eq(Document.class),
|
||||
eq(MongoIndexedSessionRepository.DEFAULT_COLLECTION_NAME)))
|
||||
.willReturn(Collections.singletonList(document));
|
||||
.willReturn(Collections.singletonList(document));
|
||||
|
||||
String sessionId = UUID.randomUUID().toString();
|
||||
|
||||
MongoSession session = new MongoSession(sessionId, 1800);
|
||||
|
||||
given(this.converter.convert(document, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(session);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(session);
|
||||
|
||||
// when
|
||||
Map<String, MongoSession> sessionsMap = this.repository.findByIndexNameAndIndexValue(principalNameIndexName,
|
||||
|
||||
@@ -83,14 +83,14 @@ public class ReactiveMongoSessionRepositoryTest {
|
||||
void shouldCreateSession() {
|
||||
|
||||
this.repository.createSession() //
|
||||
.as(StepVerifier::create) //
|
||||
.expectNextMatches((mongoSession) -> {
|
||||
assertThat(mongoSession.getId()).isNotEmpty();
|
||||
assertThat(mongoSession.getMaxInactiveInterval())
|
||||
.isEqualTo(Duration.ofSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS));
|
||||
return true;
|
||||
}) //
|
||||
.verifyComplete();
|
||||
.as(StepVerifier::create) //
|
||||
.expectNextMatches((mongoSession) -> {
|
||||
assertThat(mongoSession.getId()).isNotEmpty();
|
||||
assertThat(mongoSession.getMaxInactiveInterval())
|
||||
.isEqualTo(Duration.ofSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS));
|
||||
return true;
|
||||
}) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -101,14 +101,15 @@ public class ReactiveMongoSessionRepositoryTest {
|
||||
BasicDBObject dbSession = new BasicDBObject();
|
||||
|
||||
given(this.converter.convert(session, TypeDescriptor.valueOf(MongoSession.class),
|
||||
TypeDescriptor.valueOf(DBObject.class))).willReturn(dbSession);
|
||||
TypeDescriptor.valueOf(DBObject.class)))
|
||||
.willReturn(dbSession);
|
||||
|
||||
given(this.mongoOperations.save(dbSession, "sessions")).willReturn(Mono.just(dbSession));
|
||||
|
||||
// when
|
||||
this.repository.save(session) //
|
||||
.as(StepVerifier::create) //
|
||||
.verifyComplete();
|
||||
.as(StepVerifier::create) //
|
||||
.verifyComplete();
|
||||
|
||||
verify(this.mongoOperations).save(dbSession, ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME);
|
||||
}
|
||||
@@ -121,18 +122,20 @@ public class ReactiveMongoSessionRepositoryTest {
|
||||
Document sessionDocument = new Document();
|
||||
|
||||
given(this.mongoOperations.findById(sessionId, Document.class,
|
||||
ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME)).willReturn(Mono.just(sessionDocument));
|
||||
ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME))
|
||||
.willReturn(Mono.just(sessionDocument));
|
||||
|
||||
MongoSession session = new MongoSession();
|
||||
|
||||
given(this.converter.convert(sessionDocument, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(session);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(session);
|
||||
|
||||
// when
|
||||
this.repository.findById(sessionId) //
|
||||
.as(StepVerifier::create) //
|
||||
.expectNext(session) //
|
||||
.verifyComplete();
|
||||
.as(StepVerifier::create) //
|
||||
.expectNext(session) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,21 +146,23 @@ public class ReactiveMongoSessionRepositoryTest {
|
||||
Document sessionDocument = new Document();
|
||||
|
||||
given(this.mongoOperations.findById(sessionId, Document.class,
|
||||
ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME)).willReturn(Mono.just(sessionDocument));
|
||||
ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME))
|
||||
.willReturn(Mono.just(sessionDocument));
|
||||
|
||||
given(this.mongoOperations.remove(sessionDocument, ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME))
|
||||
.willReturn(Mono.just(DeleteResult.acknowledged(1)));
|
||||
.willReturn(Mono.just(DeleteResult.acknowledged(1)));
|
||||
|
||||
MongoSession session = mock(MongoSession.class);
|
||||
|
||||
given(session.isExpired()).willReturn(true);
|
||||
given(this.converter.convert(sessionDocument, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(session);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(session);
|
||||
|
||||
// when
|
||||
this.repository.findById(sessionId) //
|
||||
.as(StepVerifier::create) //
|
||||
.verifyComplete();
|
||||
.as(StepVerifier::create) //
|
||||
.verifyComplete();
|
||||
|
||||
// then
|
||||
verify(this.mongoOperations).remove(any(Document.class),
|
||||
@@ -172,20 +177,22 @@ public class ReactiveMongoSessionRepositoryTest {
|
||||
Document sessionDocument = new Document();
|
||||
|
||||
given(this.mongoOperations.findById(sessionId, Document.class,
|
||||
ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME)).willReturn(Mono.just(sessionDocument));
|
||||
ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME))
|
||||
.willReturn(Mono.just(sessionDocument));
|
||||
|
||||
given(this.mongoOperations.remove(sessionDocument, "sessions"))
|
||||
.willReturn(Mono.just(DeleteResult.acknowledged(1)));
|
||||
.willReturn(Mono.just(DeleteResult.acknowledged(1)));
|
||||
|
||||
MongoSession session = mock(MongoSession.class);
|
||||
|
||||
given(this.converter.convert(sessionDocument, TypeDescriptor.valueOf(Document.class),
|
||||
TypeDescriptor.valueOf(MongoSession.class))).willReturn(session);
|
||||
TypeDescriptor.valueOf(MongoSession.class)))
|
||||
.willReturn(session);
|
||||
|
||||
// when
|
||||
this.repository.deleteById(sessionId) //
|
||||
.as(StepVerifier::create) //
|
||||
.verifyComplete();
|
||||
.as(StepVerifier::create) //
|
||||
.verifyComplete();
|
||||
|
||||
verify(this.mongoOperations).remove(any(Document.class),
|
||||
eq(ReactiveMongoSessionRepository.DEFAULT_COLLECTION_NAME));
|
||||
|
||||
@@ -72,8 +72,8 @@ public class MongoHttpSessionConfigurationTest {
|
||||
void noMongoOperationsConfiguration() {
|
||||
|
||||
assertThatExceptionOfType(UnsatisfiedDependencyException.class)
|
||||
.isThrownBy(() -> registerAndRefresh(EmptyConfiguration.class))
|
||||
.withMessageContaining("mongoSessionRepository");
|
||||
.isThrownBy(() -> registerAndRefresh(EmptyConfiguration.class))
|
||||
.withMessageContaining("mongoSessionRepository");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -114,7 +114,7 @@ public class MongoHttpSessionConfigurationTest {
|
||||
MongoIndexedSessionRepository repository = this.context.getBean(MongoIndexedSessionRepository.class);
|
||||
|
||||
assertThat(repository).extracting("defaultMaxInactiveInterval")
|
||||
.isEqualTo(Duration.ofSeconds(MAX_INACTIVE_INTERVAL_IN_SECONDS));
|
||||
.isEqualTo(Duration.ofSeconds(MAX_INACTIVE_INTERVAL_IN_SECONDS));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -125,7 +125,7 @@ public class MongoHttpSessionConfigurationTest {
|
||||
MongoIndexedSessionRepository repository = this.context.getBean(MongoIndexedSessionRepository.class);
|
||||
|
||||
assertThat(repository).extracting("defaultMaxInactiveInterval")
|
||||
.isEqualTo(Duration.ofSeconds(MAX_INACTIVE_INTERVAL_IN_SECONDS));
|
||||
.isEqualTo(Duration.ofSeconds(MAX_INACTIVE_INTERVAL_IN_SECONDS));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -145,7 +145,7 @@ public class MongoHttpSessionConfigurationTest {
|
||||
void resolveCollectionNameByPropertyPlaceholder() {
|
||||
|
||||
this.context
|
||||
.setEnvironment(new MockEnvironment().withProperty("session.mongo.collectionName", COLLECTION_NAME));
|
||||
.setEnvironment(new MockEnvironment().withProperty("session.mongo.collectionName", COLLECTION_NAME));
|
||||
registerAndRefresh(CustomMongoJdbcSessionConfiguration.class);
|
||||
|
||||
MongoHttpSessionConfiguration configuration = this.context.getBean(MongoHttpSessionConfiguration.class);
|
||||
@@ -174,8 +174,8 @@ public class MongoHttpSessionConfigurationTest {
|
||||
|
||||
assertThat(repository).isNotNull();
|
||||
assertThat(indexResolver).isNotNull();
|
||||
assertThat(repository).extracting("mongoSessionConverter").hasFieldOrPropertyWithValue("indexResolver",
|
||||
indexResolver);
|
||||
assertThat(repository).extracting("mongoSessionConverter")
|
||||
.hasFieldOrPropertyWithValue("indexResolver", indexResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -189,8 +189,8 @@ public class MongoHttpSessionConfigurationTest {
|
||||
|
||||
assertThat(repository).isNotNull();
|
||||
assertThat(indexResolver).isNotNull();
|
||||
assertThat(repository).extracting("mongoSessionConverter").hasFieldOrPropertyWithValue("indexResolver",
|
||||
indexResolver);
|
||||
assertThat(repository).extracting("mongoSessionConverter")
|
||||
.hasFieldOrPropertyWithValue("indexResolver", indexResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -95,9 +95,8 @@ public class ReactiveMongoWebSessionConfigurationTest {
|
||||
this.context.register(BadConfig.class);
|
||||
|
||||
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(this.context::refresh)
|
||||
.withMessageContaining("Error creating bean with name 'reactiveMongoSessionRepository'")
|
||||
.withMessageContaining(
|
||||
"No qualifying bean of type '" + ReactiveMongoOperations.class.getCanonicalName());
|
||||
.withMessageContaining("Error creating bean with name 'reactiveMongoSessionRepository'")
|
||||
.withMessageContaining("No qualifying bean of type '" + ReactiveMongoOperations.class.getCanonicalName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -193,8 +192,8 @@ public class ReactiveMongoWebSessionConfigurationTest {
|
||||
|
||||
assertThat(repository).isNotNull();
|
||||
assertThat(indexResolver).isNotNull();
|
||||
assertThat(repository).extracting("mongoSessionConverter").hasFieldOrPropertyWithValue("indexResolver",
|
||||
indexResolver);
|
||||
assertThat(repository).extracting("mongoSessionConverter")
|
||||
.hasFieldOrPropertyWithValue("indexResolver", indexResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -209,8 +208,8 @@ public class ReactiveMongoWebSessionConfigurationTest {
|
||||
|
||||
assertThat(repository).isNotNull();
|
||||
assertThat(indexResolver).isNotNull();
|
||||
assertThat(repository).extracting("mongoSessionConverter").hasFieldOrPropertyWithValue("indexResolver",
|
||||
indexResolver);
|
||||
assertThat(repository).extracting("mongoSessionConverter")
|
||||
.hasFieldOrPropertyWithValue("indexResolver", indexResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user