-
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore unreachable/unknown URL tests when fallback exists
- Loading branch information
Showing
5 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
logback-android/src/test/java/ch/qos/logback/core/testUtil/NetworkTestUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ch.qos.logback.core.testUtil; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.core.IsNull.nullValue; | ||
import static org.hamcrest.junit.MatcherAssume.assumeThat; | ||
|
||
public class NetworkTestUtil { | ||
public void assumeNoUnresolvedUrlFallback() { | ||
// FIXME: This test fails when the ISP does not return 404 for | ||
// unknown URLs (required to cause an exception upon opening | ||
// the URL request). This was observed when running tests | ||
// while tethered to bluetooth mobile hotspot. The fix would | ||
// be to refactor AbstractIncludeAction to inject a URL opener. | ||
InetAddress addr; | ||
try { | ||
addr = InetAddress.getByName("not.a.valid.domain.name"); | ||
} catch (UnknownHostException ex) { | ||
addr = null; | ||
} | ||
assumeThat(addr, is(nullValue())); | ||
} | ||
} |