From 59211beda0aaee3469336a671de5a7ccfb62f014 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Thu, 2 Feb 2017 12:48:02 +0200 Subject: Handle system properties for failsafe plugin (#8414) * Handle system properties for failsafe plugin --- .../src/main/java/com/vaadin/tests/tb3/RetryOnFail.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'uitest-common') diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/RetryOnFail.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/RetryOnFail.java index bd3300e54f..cd735ae76b 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/RetryOnFail.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/RetryOnFail.java @@ -15,11 +15,14 @@ */ package com.vaadin.tests.tb3; +import java.util.logging.Logger; + import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; public class RetryOnFail implements TestRule { + @Override public Statement apply(Statement base, Description description) { return statement(base, description); @@ -53,8 +56,15 @@ public class RetryOnFail implements TestRule { String retryCount = System .getProperty("com.vaadin.testbench.max.retries"); - if (retryCount != null && retryCount != "") { - return Integer.parseInt(retryCount); + if (retryCount != null && !retryCount.trim().isEmpty()) { + try { + return Integer.parseInt(retryCount); + } catch (NumberFormatException e) { + // TODO: See how this was implemented in TestBench + Logger.getLogger(RetryOnFail.class.getName()).warning( + "Could not parse max retry count. Retry count set to 0. Failed value: " + + retryCount); + } } return 0; -- cgit v1.2.3