diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-19 13:07:11 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-19 13:07:11 +0100 |
commit | 4dcf22377c7823584f0d9d7dbb85641980245fd8 (patch) | |
tree | 28594d8d59c4f64deb7e3aa6f06f48b0e737cdb1 /server/sonar-db-core | |
parent | c3ae1aa643eb9edb168016bfadfbab3af9024962 (diff) | |
download | sonarqube-4dcf22377c7823584f0d9d7dbb85641980245fd8.tar.gz sonarqube-4dcf22377c7823584f0d9d7dbb85641980245fd8.zip |
Clean-up sonar-testing-harness dependencies
and decrease usages of Hamcrest
Diffstat (limited to 'server/sonar-db-core')
-rw-r--r-- | server/sonar-db-core/pom.xml | 22 | ||||
-rw-r--r-- | server/sonar-db-core/src/test/java/org/sonar/db/DatabaseCheckerTest.java | 11 |
2 files changed, 19 insertions, 14 deletions
diff --git a/server/sonar-db-core/pom.xml b/server/sonar-db-core/pom.xml index 9db00b7555c..fbb6022b1af 100644 --- a/server/sonar-db-core/pom.xml +++ b/server/sonar-db-core/pom.xml @@ -77,24 +77,28 @@ <!-- tests --> <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>sonar-testing-harness</artifactId> + <groupId>junit</groupId> + <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>com.google.code.bean-matchers</groupId> - <artifactId>bean-matchers</artifactId> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>org.simpleframework</groupId> - <artifactId>simple</artifactId> - <version>4.1.21</version> + <groupId>org.dbunit</groupId> + <artifactId>dbunit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseCheckerTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseCheckerTest.java index ebe2e86e4ba..79b8fabe357 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseCheckerTest.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseCheckerTest.java @@ -31,7 +31,6 @@ import org.sonar.db.dialect.MySql; import org.sonar.db.dialect.Oracle; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.is; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -120,14 +119,16 @@ public class DatabaseCheckerTest { @Test public void fail_if_cant_get_db_version() throws Exception { SQLException sqlException = new SQLException(); - expectedException.expect(RuntimeException.class); - expectedException.expectCause(is(sqlException)); - Database db = mock(Database.class, Mockito.RETURNS_DEEP_STUBS); when(db.getDialect()).thenReturn(new MySql()); when(db.getDataSource().getConnection().getMetaData()).thenThrow(sqlException); - new DatabaseChecker(db).start(); + try { + new DatabaseChecker(db).start(); + fail(); + } catch (RuntimeException e) { + assertThat(e.getCause()).isSameAs(sqlException); + } } private Database mockDb(Dialect dialect, int dbMajorVersion, int dbMinorVersion, String driverVersion) throws SQLException { |