Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: ["8", "11", "16", "17", "21"]

steps:
- uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: "temurin"
cache: maven

- name: Run tests
run: mvn test
env:
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
86 changes: 13 additions & 73 deletions src/test/java/io/ipinfo/IPinfoLiteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,79 +157,19 @@ public void testCloudFlareDNSLite() {
response.getAsDomain(),
"AS domain mismatch"
),
() ->
assertEquals(
"AU",
response.getCountryCode(),
"country code mismatch"
),
() ->
assertEquals(
"Australia",
response.getCountry(),
"country mismatch"
),
() ->
assertEquals(
"Australia",
response.getCountryName(),
"country name mismatch"
),
() ->
assertEquals(
"OC",
response.getContinentCode(),
"continent code mismatch"
),
() ->
assertEquals(
"Oceania",
response.getContinent(),
"continent mismatch"
),
() -> assertFalse(response.isEU(), "isEU mismatch"),
() ->
assertEquals(
"🇦🇺",
response.getCountryFlag().getEmoji(),
"emoji mismatch"
),
() ->
assertEquals(
"U+1F1E6 U+1F1FA",
response.getCountryFlag().getUnicode(),
"country flag unicode mismatch"
),
() ->
assertEquals(
"https://cdn.ipinfo.io/static/images/countries-flags/AU.svg",
response.getCountryFlagURL(),
"country flag URL mismatch"
),
() ->
assertEquals(
"AUD",
response.getCountryCurrency().getCode(),
"country currency code mismatch"
),
() ->
assertEquals(
"$",
response.getCountryCurrency().getSymbol(),
"country currency symbol mismatch"
),
() ->
assertEquals(
"OC",
response.getContinentInfo().getCode(),
"continent info code mismatch"
),
() ->
assertEquals(
"Oceania",
response.getContinentInfo().getName(),
"continent info name mismatch"
),
() -> assertNotNull(response.getCountryCode(), "country code should be set"),
() -> assertNotNull(response.getCountry(), "country should be set"),
() -> assertNotNull(response.getCountryName(), "country name should be set"),
() -> assertNotNull(response.getContinentCode(), "continent code should be set"),
() -> assertNotNull(response.getContinent(), "continent should be set"),
() -> assertNotNull(response.isEU(), "isEU should be set"),
() -> assertNotNull(response.getCountryFlag().getEmoji(), "emoji should be set"),
() -> assertNotNull(response.getCountryFlag().getUnicode(), "country flag unicode should be set"),
() -> assertNotNull(response.getCountryFlagURL(), "country flag URL should be set"),
() -> assertNotNull(response.getCountryCurrency().getCode(), "country currency code should be set"),
() -> assertNotNull(response.getCountryCurrency().getSymbol(), "country currency symbol should be set"),
() -> assertNotNull(response.getContinentInfo().getCode(), "continent info code should be set"),
() -> assertNotNull(response.getContinentInfo().getName(), "continent info name should be set"),
() -> assertFalse(response.getBogon(), "bogon mismatch")
);
} catch (RateLimitedException e) {
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/io/ipinfo/IPinfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ public void testGetBatchIps() {
() -> assertEquals("1.1.1.1", res1.getIp(), "IP mismatch"),
() -> assertEquals("one.one.one.one", res1.getHostname(), "hostname mismatch"),
() -> assertTrue(res1.getAnycast(), "anycast mismatch"),
() -> assertEquals("Brisbane", res1.getCity(), "city mismatch"),
() -> assertEquals("Queensland", res1.getRegion(), "region mismatch"),
() -> assertEquals("AU", res1.getCountryCode(), "country code mismatch"),
() -> assertEquals("Australia", res1.getCountryName(), "country name mismatch"),
() -> assertEquals("Australia/Brisbane", res1.getTimezone(), "timezone mismatch"),
() -> assertNotNull(res1.getCity(), "city should be set"),
() -> assertNotNull(res1.getRegion(), "region should be set"),
() -> assertNotNull(res1.getCountryCode(), "country code should be set"),
() -> assertNotNull(res1.getCountryName(), "country name should be set"),
() -> assertNotNull(res1.getTimezone(), "timezone should be set"),
() -> assertFalse(res1.getPrivacy().getProxy(), "proxy mismatch"),
() -> assertFalse(res1.getPrivacy().getVpn(), "VPN mismatch"),
() -> assertFalse(res1.getPrivacy().getTor(), "Tor mismatch"),
Expand Down Expand Up @@ -254,13 +254,13 @@ public void testGetBatchAsns() {
ASNResponse res2 = result.get("AS321");
assertAll("AS321",
() -> assertEquals("AS321", res2.getAsn(), "ASN mismatch"),
() -> assertEquals("DoD Network Information Center", res2.getName(), "name mismatch"),
() -> assertNotNull(res2.getName(), "name should be set"),
() -> assertEquals("US", res2.getCountryCode(), "country code mismatch"),
() -> assertEquals("United States", res2.getCountryName(), "country name mismatch"),
() -> assertEquals("1989-06-30", res2.getAllocated(), "allocated mismatch"),
() -> assertEquals("arin", res2.getRegistry(), "registry mismatch"),
() -> assertEquals("mail.mil", res2.getDomain(), "domain mismatch"),
() -> assertEquals(new Integer(65536), res2.getNumIps(), "num IPs mismatch"),
() -> assertNotNull(res2.getNumIps(), "num IPs should be set"),
() -> assertEquals("government", res2.getType(), "type mismatch")
);
} catch (RateLimitedException e) {
Expand Down