Merge pull request #312 from mishako/fix-cc-license-test

Fix license test in cc module
This commit is contained in:
Patrick Gotthard 2016-07-19 11:03:39 +02:00 committed by GitHub
commit 1606804f0f

View file

@ -23,11 +23,13 @@ import java.util.concurrent.atomic.AtomicLong;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import com.rometools.modules.cc.types.License; import org.slf4j.LoggerFactory;
public class LicenseTest { public class LicenseTest {
private static final Logger LOG = LoggerFactory.getLogger(LicenseTest.class);
@Before @Before
public void setUp() { public void setUp() {
// As the looked up licenses are held statically we need to clear this between tests. // As the looked up licenses are held statically we need to clear this between tests.
@ -54,6 +56,7 @@ public class LicenseTest {
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
LOG.error("Exception in add-new thread", e);
hadException.set(true); hadException.set(true);
} }
} }
@ -66,12 +69,17 @@ public class LicenseTest {
final Random rnd = new Random(); final Random rnd = new Random();
try { try {
while (run.get()) { while (run.get()) {
if (type.intValue() == 0) {
continue;
}
final License license = License.findByValue("http://creativecommons.org/licenses/" + rnd.nextInt(type.intValue()) + "/1"); final License license = License.findByValue("http://creativecommons.org/licenses/" + rnd.nextInt(type.intValue()) + "/1");
if (license == null) { if (license == null) {
hadProblem.set(true); hadProblem.set(true);
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
LOG.error("Exception in get-existing thread", e);
hadException.set(true); hadException.set(true);
} }
} }