@Rule
public TemporaryFolder temp = new TemporaryFolder();
@Test
public void test_deploy() throws Exception {
DefaultServerFileSystem fs = mock(DefaultServerFileSystem.class);
File driver = new File(Resources.getResource(getClass(), "JdbcDriverDeployerTest/deploy/my-driver.jar").toURI());
Settings settings = new Settings();
settings.setProperty("sonar.jdbc.driverPath", driver.getAbsolutePath());
File deployDir = temp.newFolder("deploy");
when(fs.getDeployDir()).thenReturn(deployDir);
File deployedIndex = new File(deployDir, "jdbc-driver.txt");
File deployedFile = new File(deployDir, "my-driver.jar");
assertThat(deployedIndex).doesNotExist();
assertThat(deployedFile).doesNotExist();
when(fs.getDeployedJdbcDriverIndex()).thenReturn(deployedIndex);
new JdbcDriverDeployer(fs, settings).start();
assertThat(deployedIndex).exists();
assertThat(deployedFile).exists();