Skip to content

Commit 57e106d

Browse files
authored
Merge pull request #16 from ipinfo/uman/fixes
Fixes for test cases
2 parents 733e63f + 05e91d2 commit 57e106d

File tree

6 files changed

+31
-17
lines changed

6 files changed

+31
-17
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
target/
3+
.vim/

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sudo: false
22
language: java
3-
3+
dist: trusty
44
jdk:
55
- oraclejdk8
66

@@ -18,5 +18,3 @@ branches:
1818
cache:
1919
directories:
2020
- $HOME/.m2
21-
22-

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
<version>5.2.0</version>
7676
<scope>test</scope>
7777
</dependency>
78+
<dependency>
79+
<groupId>org.junit.jupiter</groupId>
80+
<artifactId>junit-jupiter-engine</artifactId>
81+
<version>5.2.0</version>
82+
<scope>test</scope>
83+
</dependency>
7884
</dependencies>
7985

8086
<build>

scripts/ctags.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Regenerate ctags.
4+
5+
ctags \
6+
--recurse=yes \
7+
--exclude=node_modules \
8+
--exclude=dist \
9+
--exclude=build \
10+
--exclude=target \
11+
-f .vim/tags \
12+
--tag-relative=never \
13+
--totals=yes \
14+
./src

src/main/java/io/ipinfo/api/IPInfoBuilder.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public IPInfoBuilder setCache(Cache cache) {
4242
}
4343

4444
public IPInfo build() {
45-
Type type = new TypeToken<Map<String, String>>() {
46-
}.getType();
47-
45+
Type type = new TypeToken<Map<String, String>>(){}.getType();
4846
Gson gson = new Gson();
4947
Map<String, String> map;
5048

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,28 @@
99

1010
import static org.junit.jupiter.api.Assertions.*;
1111

12-
public class IPInfoTests {
12+
public class IPInfoTest {
1313
private IPInfo ipInfo;
1414

15-
@BeforeEach
16-
void initAll() {
17-
ipInfo = IPInfo.builder().build();
18-
}
19-
2015
@Test
21-
void testGoogleDNS() {
16+
public void testGoogleDNS() {
17+
ipInfo = IPInfo.builder().build();
2218
try {
2319
IPResponse response = ipInfo.lookupIP("8.8.8.8");
24-
2520
assertAll("Country Code",
2621
() -> assertEquals(response.getCountryCode(), "US"),
2722
() -> assertEquals(response.getCountryName(), "United States"),
28-
() -> assertEquals(response.getHostname(), "google-public-dns-a.google.com"),
23+
() -> assertEquals(response.getHostname(), "dns.google"),
2924
() -> assertEquals(response.getIp(), "8.8.8.8")
3025
);
31-
3226
} catch (RateLimitedException e) {
3327
fail(e);
3428
}
3529
}
3630

3731
@Test
38-
void testASNWithoutAuth() {
32+
public void testASNWithoutAuth() {
33+
ipInfo = IPInfo.builder().build();
3934
assertThrows(ErrorResponseException.class, () -> ipInfo.lookupASN("AS7922"));
4035
}
4136
}

0 commit comments

Comments
 (0)