Skip to content

Commit

Permalink
Ignore blocked remote tests on CI server
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb authored and simonharrer committed Sep 28, 2015
1 parent 798e365 commit 3288130
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/test/java/net/sf/jabref/logic/fetcher/GoogleScholarTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package net.sf.jabref.logic.fetcher;

import net.sf.jabref.model.entry.BibtexEntry;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import net.sf.jabref.support.DevEnvironment;
import org.junit.*;

import java.io.IOException;
import java.net.URL;
Expand Down Expand Up @@ -31,6 +30,9 @@ public void requiresEntryTitle() throws IOException {

@Test
public void linkFound() throws IOException {
// CI server is blocked by Google
Assume.assumeFalse(DevEnvironment.isCIServer());

entry.setField("title", "Towards Application Portability in Platform as a Service");

Assert.assertEquals(
Expand All @@ -41,6 +43,9 @@ public void linkFound() throws IOException {

@Test
public void noLinkFound() throws IOException {
// CI server is blocked by Google
Assume.assumeFalse(DevEnvironment.isCIServer());

entry.setField("title", "Pro WF: Windows Workflow in NET 3.5");

Assert.assertEquals(Optional.empty(), finder.findFullText(entry));
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/net/sf/jabref/support/DevEnvironment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.sf.jabref.support;

/**
* Checks whether we are on a local development environment and not on a CI server.
* This is needed as some remote fetcher tests are blocked by Google when executed by CI servers.
*/
public class DevEnvironment {
public static boolean isCIServer() {
// See http://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
// See https://circleci.com/docs/environment-variables
return Boolean.valueOf(System.getenv("CI"));
}
}

0 comments on commit 3288130

Please sign in to comment.