diff --git a/example-cucumber/pom.xml b/example-cucumber/pom.xml index facca9e0..283c9e65 100644 --- a/example-cucumber/pom.xml +++ b/example-cucumber/pom.xml @@ -23,13 +23,13 @@ com.epam.reportportal agent-java-cucumber - 5.2.0 + 5.2.1 com.epam.reportportal logger-java-logback - 5.2.0 + 5.2.1 diff --git a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/AttachmentHelper.java b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/AttachmentHelper.java index b3ab3dd7..a3f84afb 100644 --- a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/AttachmentHelper.java +++ b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/AttachmentHelper.java @@ -1,10 +1,10 @@ package com.epam.reportportal.example.cucumber.util; -import com.google.common.io.Files; -import com.google.common.io.Resources; +import com.epam.reportportal.utils.files.Utils; import java.io.File; import java.io.IOException; +import java.nio.file.Files; public class AttachmentHelper { @@ -14,7 +14,10 @@ public static File getFileFromResources(String name, String extension) { File file = null; try { file = File.createTempFile("rp-test", extension); - Resources.asByteSource(Resources.getResource(String.format("files/%s%s", name, extension))).copyTo(Files.asByteSink(file)); + Utils.copyStreams( + Utils.getFile(new File(String.format("files/%s%s", name, extension))).openStream(), + Files.newOutputStream(file.toPath()) + ); } catch (IOException ignored) { } return file; diff --git a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/MagicRandomizer.java b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/MagicRandomizer.java index ae1b06f8..d2e7b4ff 100644 --- a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/MagicRandomizer.java +++ b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/util/MagicRandomizer.java @@ -2,8 +2,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Preconditions; -import com.google.common.collect.Range; import java.util.Random; @@ -16,9 +14,8 @@ public class MagicRandomizer { private static final Logger LOGGER = LoggerFactory.getLogger(MagicRandomizer.class); - private static final Range PROBABILITY_RANGE = Range.openClosed(0, 100); - private static final Random RANDOM = new Random(); + private static final int UPPER_LIMIT = 100; private MagicRandomizer() { //statics only @@ -35,10 +32,7 @@ public static int luckyInt(int bound) { * @return TRUE if you are really lucky! */ public static boolean checkYourLucky(int probability) { - Preconditions.checkArgument(PROBABILITY_RANGE.contains(probability), "%s is not in range [%s]", probability, PROBABILITY_RANGE); - - boolean lucky = Range.closedOpen(PROBABILITY_RANGE.lowerEndpoint(), probability) - .contains(luckyInt(PROBABILITY_RANGE.upperEndpoint())); + boolean lucky = luckyInt(UPPER_LIMIT + 1) <= probability; LOGGER.debug("Generating [TRUE/FALSE] with probability {}%. Result {}", probability, lucky); return lucky; }