"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/init/ConnectionFactoryInitializerUnitTests.java" between
spring-framework-5.3.7.tar.gz and spring-framework-5.3.8.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

ConnectionFactoryInitializerUnitTests.java  (spring-framework-5.3.7):ConnectionFactoryInitializerUnitTests.java  (spring-framework-5.3.8)
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * https://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
skipping to change at line 35 skipping to change at line 35
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.when; import static org.mockito.BDDMockito.when;
/** /**
* Unit tests for {@link ConnectionFactoryInitializer}. * Unit tests for {@link ConnectionFactoryInitializer}.
* *
* @author Mark Paluch * @author Mark Paluch
*/ */
public class ConnectionFactoryInitializerUnitTests { class ConnectionFactoryInitializerUnitTests {
AtomicBoolean called = new AtomicBoolean(); AtomicBoolean called = new AtomicBoolean();
DatabasePopulator populator = mock(DatabasePopulator.class); DatabasePopulator populator = mock(DatabasePopulator.class);
MockConnection connection = MockConnection.builder().build(); MockConnection connection = MockConnection.builder().build();
MockConnectionFactory connectionFactory = MockConnectionFactory.builder() MockConnectionFactory connectionFactory = MockConnectionFactory.builder()
.connection( .connection(connection).build();
connection).build();
@Test @Test
public void shouldInitializeConnectionFactory() { void shouldInitializeConnectionFactory() {
when(populator.populate(connectionFactory)).thenReturn( when(populator.populate(connectionFactory)).thenReturn(
Mono.<Void> empty().doOnSubscribe(subscription -> called.set(true))); Mono.<Void> empty().doOnSubscribe(subscription -> called.set(true)));
ConnectionFactoryInitializer initializer = new ConnectionFactoryI nitializer(); ConnectionFactoryInitializer initializer = new ConnectionFactoryI nitializer();
initializer.setConnectionFactory(connectionFactory); initializer.setConnectionFactory(connectionFactory);
initializer.setDatabasePopulator(populator); initializer.setDatabasePopulator(populator);
initializer.afterPropertiesSet(); initializer.afterPropertiesSet();
assertThat(called).isTrue(); assertThat(called).isTrue();
} }
@Test @Test
public void shouldCleanConnectionFactory() { void shouldCleanConnectionFactory() {
when(populator.populate(connectionFactory)).thenReturn( when(populator.populate(connectionFactory)).thenReturn(
Mono.<Void> empty().doOnSubscribe(subscription -> called.set(true))); Mono.<Void> empty().doOnSubscribe(subscription -> called.set(true)));
ConnectionFactoryInitializer initializer = new ConnectionFactoryI nitializer(); ConnectionFactoryInitializer initializer = new ConnectionFactoryI nitializer();
initializer.setConnectionFactory(connectionFactory); initializer.setConnectionFactory(connectionFactory);
initializer.setDatabaseCleaner(populator); initializer.setDatabaseCleaner(populator);
initializer.afterPropertiesSet();
initializer.destroy(); initializer.destroy();
assertThat(called).isTrue(); assertThat(called).isTrue();
} }
} }
 End of changes. 6 change blocks. 
8 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)