Replace Mockito.times(0) with Mockito.never()

Closes gh-12475
This commit is contained in:
dreis2211
2018-03-14 10:09:31 +01:00
committed by Phillip Webb
parent 1412e7e690
commit 8626daf135
14 changed files with 50 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -39,8 +39,8 @@ import org.springframework.context.annotation.Configuration;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
@@ -57,7 +57,7 @@ public abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
SingleDataSourceConfiguration.class);
DataSource dataSource = context.getBean(DataSource.class);
Statement statement = configureDataSourceBehavior(dataSource);
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
@Test
@@ -69,7 +69,7 @@ public abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
.values();
for (DataSource dataSource : dataSources) {
Statement statement = configureDataSourceBehavior(dataSource);
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -29,7 +29,7 @@ import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
import org.springframework.context.ConfigurableApplicationContext;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
/**
@@ -49,7 +49,7 @@ public class DevToolsEmbeddedDataSourceAutoConfigurationTests
Statement statement = configureDataSourceBehavior(
context.getBean(DataSource.class));
context.close();
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -28,6 +28,7 @@ import org.junit.Test;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -66,7 +67,7 @@ public class DevToolsPooledDataSourceAutoConfigurationTests
Statement statement = configureDataSourceBehavior(
context.getBean(DataSource.class));
context.close();
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
@Test
@@ -77,7 +78,7 @@ public class DevToolsPooledDataSourceAutoConfigurationTests
Statement statement = configureDataSourceBehavior(
context.getBean(DataSource.class));
context.close();
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
@Test
@@ -99,7 +100,7 @@ public class DevToolsPooledDataSourceAutoConfigurationTests
Statement statement = configureDataSourceBehavior(
context.getBean(DataSource.class));
context.close();
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
@Test
@@ -121,7 +122,7 @@ public class DevToolsPooledDataSourceAutoConfigurationTests
Statement statement = configureDataSourceBehavior(
context.getBean(DataSource.class));
context.close();
verify(statement, times(0)).execute("SHUTDOWN");
verify(statement, never()).execute("SHUTDOWN");
}
@Test