diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-06-02 16:33:41 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-06-02 18:01:17 +0200 |
commit | 30897a5cc582668577b82efeca60b732e8e42ff1 (patch) | |
tree | 7e9b8a4ec0996b8796acb4fa6566c7c17f83d668 | |
parent | 9795a6734c87298a13d91a23d4351fa0ffde7bf7 (diff) | |
download | sonarqube-30897a5cc582668577b82efeca60b732e8e42ff1.tar.gz sonarqube-30897a5cc582668577b82efeca60b732e8e42ff1.zip |
add missing coverage on BatchReportDirectoryHolderImpl
in addition, removed repetitive declaration from implement list
2 files changed, 43 insertions, 1 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImpl.java index 6477b7aa6a2..e6e3556393b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImpl.java @@ -22,7 +22,7 @@ package org.sonar.server.computation.batch; import java.io.File; import java.util.Objects; -public class BatchReportDirectoryHolderImpl implements BatchReportDirectoryHolder, MutableBatchReportDirectoryHolder { +public class BatchReportDirectoryHolderImpl implements MutableBatchReportDirectoryHolder { private File directory; @Override diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImplTest.java new file mode 100644 index 00000000000..6f369f7906b --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/BatchReportDirectoryHolderImplTest.java @@ -0,0 +1,42 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.computation.batch; + +import java.io.File; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class BatchReportDirectoryHolderImplTest { + + @Test(expected = IllegalStateException.class) + public void getDirectory_throws_ISE_if_holder_is_empty() { + new BatchReportDirectoryHolderImpl().getDirectory(); + } + + @Test + public void getDirectory_returns_File_set_with_setDirectory() { + File file = new File(""); + BatchReportDirectoryHolderImpl holder = new BatchReportDirectoryHolderImpl(); + holder.setDirectory(file); + + assertThat(holder.getDirectory()).isSameAs(file); + } +} |