-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from dartartem/master
Added url testing util.
- Loading branch information
Showing
4 changed files
with
21 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
|
||
dependencies { | ||
compile "junit:junit:4.12" | ||
} |
15 changes: 15 additions & 0 deletions
15
eventuate-util-test/src/main/java/io/eventuate/util/test/async/UrlTesting.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,15 @@ | ||
package io.eventuate.util.test.async; | ||
|
||
import org.junit.Assert; | ||
|
||
import java.io.IOException; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
public class UrlTesting { | ||
public static void assertUrlStatusIsOk(String host, int port, String path) throws IOException { | ||
HttpURLConnection connection = (HttpURLConnection)new URL(String.format("http://%s:%s%s", host, port, path)).openConnection(); | ||
|
||
Assert.assertEquals(200, connection.getResponseCode()); | ||
} | ||
} |