forked from chhsiao90/nitmproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support default value when resoving address without port
- Loading branch information
Showing
4 changed files
with
61 additions
and
23 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
22 changes: 22 additions & 0 deletions
22
src/test/java/com/github/chhsiao90/nitmproxy/AddressTest.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,22 @@ | ||
package com.github.chhsiao90.nitmproxy; | ||
|
||
import org.junit.Test; | ||
|
||
import static com.github.chhsiao90.nitmproxy.Address.*; | ||
import static org.assertj.core.api.Assertions.*; | ||
import static org.junit.Assert.*; | ||
|
||
public class AddressTest { | ||
@Test | ||
public void shouldResolve() { | ||
assertEquals(address("localhost", 80), resolve("localhost:80")); | ||
assertEquals(address("localhost", 80), resolve("localhost", 80)); | ||
assertEquals(address("www.google.com", 443), resolve("www.google.com:443")); | ||
assertEquals(address("www.google.com", 443), resolve("www.google.com", 443)); | ||
} | ||
|
||
@Test | ||
public void shouldResolveFailed() { | ||
assertThatThrownBy(() -> resolve("localhost")); | ||
} | ||
} |