*/
package org.sonar.server.computation.task.projectanalysis.batch;
-import com.google.common.base.Optional;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import org.sonar.core.util.CloseableIterator;
import org.sonar.scanner.protocol.output.ScannerReport;
*/
package org.sonar.server.computation.task.projectanalysis.batch;
-import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Parser;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.NoSuchElementException;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
ensureInitialized();
File file = delegate.readFileSource(fileRef);
if (file == null) {
- return Optional.absent();
+ return Optional.empty();
}
try {
* <p>
* The returned {@link CloseableIterator} will wrap the {@link CloseableIterator} returned by
* {@link org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader#readFileSource(int)} but enforces that the number
- * of lines specified by {@link org.sonar.batch.protocol.output.ScannerReport.Component#getLines()} is respected, adding
+ * of lines specified by {@link org.sonar.scanner.protocol.output.ScannerReport.Component#getLines()} is respected, adding
* an extra empty last line if required.
* </p>
*
*/
package org.sonar.server.computation.task.projectanalysis.source;
-import com.google.common.base.Optional;
+import java.util.Optional;
import org.sonar.core.util.CloseableIterator;
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader;
import org.sonar.server.computation.task.projectanalysis.component.Component;
import static com.google.common.collect.ImmutableList.of;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.guava.api.Assertions.assertThat;
public class BatchReportReaderImplTest {
private static final int COMPONENT_REF = 1;
@Test
public void readFileSource_returns_absent_optional_when_file_does_not_exist() {
- assertThat(underTest.readFileSource(COMPONENT_REF)).isAbsent();
+ assertThat(underTest.readFileSource(COMPONENT_REF)).isEmpty();
}
@Test
*/
package org.sonar.server.computation.task.projectanalysis.batch;
-import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.junit.rules.TestRule;
public Optional<CloseableIterator<String>> readFileSource(int fileRef) {
List<String> lines = fileSources.get(fileRef);
if (lines == null) {
- return Optional.absent();
+ return Optional.empty();
}
return Optional.of(CloseableIterator.from(lines.iterator()));