From: Sébastien Lesaint Date: Tue, 2 Jun 2015 14:33:41 +0000 (+0200) Subject: add missing coverage on BatchReportDirectoryHolderImpl X-Git-Tag: 5.2-RC1~1686 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=30897a5cc582668577b82efeca60b732e8e42ff1;p=sonarqube.git add missing coverage on BatchReportDirectoryHolderImpl in addition, removed repetitive declaration from implement list --- 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); + } +}