aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-10-09 22:45:59 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-10-11 13:34:27 +0200
commit52f7e44133feff053d55569f17f06654822b821c (patch)
tree05009f8959b913f45f22ff32de639a059f781229 /sonar-plugin-api
parentbaf3fdf7fecd2ae48731a603fb261d12a84d1c05 (diff)
downloadsonarqube-52f7e44133feff053d55569f17f06654822b821c.tar.gz
sonarqube-52f7e44133feff053d55569f17f06654822b821c.zip
SONAR-9930 improve naming in DefaultTempFolderTest
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/DefaultTempFolderTest.java40
1 files changed, 22 insertions, 18 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/DefaultTempFolderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/DefaultTempFolderTest.java
index 62ec60f1d49..0efdef9dd48 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/DefaultTempFolderTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/DefaultTempFolderTest.java
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class DefaultTempFolderTest {
@Rule
- public ExpectedException throwable = ExpectedException.none();
+ public ExpectedException expectedException = ExpectedException.none();
@Rule
public TemporaryFolder temp = new TemporaryFolder();
@@ -44,52 +44,56 @@ public class DefaultTempFolderTest {
@Test
public void createTempFolderAndFile() throws Exception {
File rootTempFolder = temp.newFolder();
- DefaultTempFolder tempFolder = new DefaultTempFolder(rootTempFolder);
- File dir = tempFolder.newDir();
+ DefaultTempFolder underTest = new DefaultTempFolder(rootTempFolder);
+ File dir = underTest.newDir();
assertThat(dir).exists().isDirectory();
- File file = tempFolder.newFile();
+ File file = underTest.newFile();
assertThat(file).exists().isFile();
- new TempFolderCleaner(tempFolder).stop();
+ new TempFolderCleaner(underTest).stop();
assertThat(rootTempFolder).doesNotExist();
}
@Test
public void createTempFolderWithName() throws Exception {
File rootTempFolder = temp.newFolder();
- DefaultTempFolder tempFolder = new DefaultTempFolder(rootTempFolder);
- File dir = tempFolder.newDir("sample");
+ DefaultTempFolder underTest = new DefaultTempFolder(rootTempFolder);
+ File dir = underTest.newDir("sample");
assertThat(dir).exists().isDirectory();
assertThat(new File(rootTempFolder, "sample")).isEqualTo(dir);
- new TempFolderCleaner(tempFolder).stop();
+ new TempFolderCleaner(underTest).stop();
assertThat(rootTempFolder).doesNotExist();
}
@Test
- public void createTempFolderWithInvalidName() throws Exception {
+ public void newDir_throws_ISE_if_name_is_not_valid() throws Exception {
File rootTempFolder = temp.newFolder();
- DefaultTempFolder tempFolder = new DefaultTempFolder(rootTempFolder);
+ DefaultTempFolder underTest = new DefaultTempFolder(rootTempFolder);
String tooLong = "tooooolong";
for (int i = 0; i < 50; i++) {
tooLong += "tooooolong";
}
- throwable.expect(IllegalStateException.class);
- throwable.expectMessage("Failed to create temp directory");
- tempFolder.newDir(tooLong);
+
+ expectedException.expect(IllegalStateException.class);
+ expectedException.expectMessage("Failed to create temp directory");
+
+ underTest.newDir(tooLong);
}
@Test
- public void createNewFileWithInvalidName() throws Exception {
+ public void newFile_throws_ISE_if_name_is_not_valid() throws Exception {
File rootTempFolder = temp.newFolder();
- DefaultTempFolder tempFolder = new DefaultTempFolder(rootTempFolder);
+ DefaultTempFolder underTest = new DefaultTempFolder(rootTempFolder);
String tooLong = "tooooolong";
for (int i = 0; i < 50; i++) {
tooLong += "tooooolong";
}
- throwable.expect(IllegalStateException.class);
- throwable.expectMessage("Failed to create temp file");
- tempFolder.newFile(tooLong, ".txt");
+
+ expectedException.expect(IllegalStateException.class);
+ expectedException.expectMessage("Failed to create temp file");
+
+ underTest.newFile(tooLong, ".txt");
}
@Test