Skip to content

Commit 09962db

Browse files
committed
fixed coverage report configuration
1 parent f034ca4 commit 09962db

3 files changed

Lines changed: 58 additions & 9 deletions

File tree

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,5 @@ addons:
1010
organization: yassine-github
1111
token:
1212
secure: PYT5/IbiqFd877vdi+CYTx7srXr5ACvAgBSL4rxPqwVSQUdGIZxVTj8JcZp7Cl2WiDj9zDlTHSDaJDt5ZpXnmN5quJBizuCZDVArm3LoRADjxhOd9N8rQEYEE1TZOHlu1+g1i/abOL+av9Spn7lWk1LvuH5BW3b0GiAdqJFevfnJsUYDh4iYHiMYjTIP5dO/cZUnQzgFgZS6YkMA28cgQIy/F03z6tO9oM6kcJ/DGBnqvdGAT2ZxtWhFaaNwJazlxSePCwnOok+v3vgACzGospTJLQ4AdGklYIK+ljGpz7AbiRs7yhvzsib6i5Wr0IEmZmLiyIgjExPdnV+rXAndgig/0bnhv1YzyEf/hCzMczpHvNa0HDAGCxkTIsw76XlumwPMGURdlypWEoWrz/9cwiPMnQ0XcAOTN56msA5nBbNwnJ9KDKIVWKWg447OhbImlTr+qxHI/L+8e1dFxyA1iBg7/wtU/27V2QRABvhdlVGNn1khdkIKhsueYHbBjloUTILHBFKTtJdZdD2z/Vf9cu51EQDwv5IPfkkz/UER8pw4AVKgFi6v57M3unqE5C6g8dZr5CELAqy3tGjf6v9HaTF3AdGEkyIJuxiiO8LM20MJm+IreR/pIv8SVeT7f747hbPCQ+mMe5rSE4KVtSI88OeUcI193pdd5PBg0jU262I=
13-
cache:
14-
directories:
15-
- '$HOME/.m2/repository'
16-
- '$HOME/.sonar/cache'
1713
notifications:
1814
email: false

pom.groovy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ project {
1010
'version.client.feign' '9.7.0'
1111
'version.build.jacoco' '0.8.4'
1212
'version.build.surefire' '3.0.0-M3'
13-
'sonar.jacoco.reportPaths' '${project.build.directory}/coverage-reports/jacoco-ut.exec'
13+
'sonar.organization' 'yassine-github'
14+
'sonar.coverage.jacoco.xmlReportPaths' 'target/site/code-coverage/jacoco.xml'
1415
'sonar.links.homepage' 'https://github.com/yassine/ipdata-java-client'
1516
'sonar.links.issue' 'https://github.com/yassine/ipdata-java-client'
1617
'sonar.links.scm' 'https://github.com/yassine/ipdata-java-client'
1718
'sonar.projectKey' 'yassine_ipdata-java-client'
1819
'sonar.projectName' 'ipdata-java-client'
1920
'sonar.projectVersion' '${project.version}'
2021
'sonar.host.url' 'https://sonarcloud.io'
21-
'sonar.tests' '${project.basedir}/src/test'
22-
'sonar.java.coveragePlugin' 'jacoco'
23-
'sonar.dynamicAnalysis' 'reuseReports'
22+
2423
}
2524
dependencies {
2625
dependency('io.github.openfeign:feign-core:${version.client.feign}')

src/test/java/io/ipdata/client/IpdataFunctionalTest.java

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.fasterxml.jackson.databind.ObjectMapper;
1313
import com.google.common.collect.ImmutableMap;
1414
import feign.httpclient.ApacheHttpClient;
15+
import io.ipdata.client.error.IpdataException;
1516
import io.ipdata.client.error.RateLimitException;
1617
import io.ipdata.client.model.AsnModel;
1718
import io.ipdata.client.model.Currency;
@@ -143,17 +144,70 @@ public void testBulkResponse() {
143144
}
144145

145146
@SneakyThrows
146-
@Test(expected = RateLimitException.class)
147+
@Test(expected = IpdataException.class)
147148
public void testError() {
148149
URL url = new URL("https://api.ipdata.co");
149150
IpdataService serviceWithInvalidKey = Ipdata.builder().url(url)
150151
.key("THIS_IS_AN_INVALID_KEY")
152+
.withDefaultCache()
151153
.feignClient(new ApacheHttpClient(HttpClientBuilder.create()
152154
.setSSLHostnameVerifier(new NoopHostnameVerifier()).setConnectionTimeToLive(10, TimeUnit.SECONDS)
153155
.build())).get();
154156
serviceWithInvalidKey.ipdata("8.8.8.8");
155157
}
156158

159+
@SneakyThrows
160+
@Test(expected = IpdataException.class)
161+
public void testAsnError() {
162+
URL url = new URL("https://api.ipdata.co");
163+
IpdataService serviceWithInvalidKey = Ipdata.builder().url(url)
164+
.key("THIS_IS_AN_INVALID_KEY")
165+
.withDefaultCache()
166+
.feignClient(new ApacheHttpClient(HttpClientBuilder.create()
167+
.setSSLHostnameVerifier(new NoopHostnameVerifier()).setConnectionTimeToLive(10, TimeUnit.SECONDS)
168+
.build())).get();
169+
serviceWithInvalidKey.asn("8.8.8.8");
170+
}
171+
172+
@SneakyThrows
173+
@Test(expected = IpdataException.class)
174+
public void testThreatError() {
175+
URL url = new URL("https://api.ipdata.co");
176+
IpdataService serviceWithInvalidKey = Ipdata.builder().url(url)
177+
.key("THIS_IS_AN_INVALID_KEY")
178+
.withDefaultCache()
179+
.feignClient(new ApacheHttpClient(HttpClientBuilder.create()
180+
.setSSLHostnameVerifier(new NoopHostnameVerifier()).setConnectionTimeToLive(10, TimeUnit.SECONDS)
181+
.build())).get();
182+
serviceWithInvalidKey.threat("8.8.8.8");
183+
}
184+
185+
@SneakyThrows
186+
@Test(expected = IpdataException.class)
187+
public void testTimeZoneError() {
188+
URL url = new URL("https://api.ipdata.co");
189+
IpdataService serviceWithInvalidKey = Ipdata.builder().url(url)
190+
.key("THIS_IS_AN_INVALID_KEY")
191+
.withDefaultCache()
192+
.feignClient(new ApacheHttpClient(HttpClientBuilder.create()
193+
.setSSLHostnameVerifier(new NoopHostnameVerifier()).setConnectionTimeToLive(10, TimeUnit.SECONDS)
194+
.build())).get();
195+
serviceWithInvalidKey.timeZone("8.8.8.8");
196+
}
197+
198+
@SneakyThrows
199+
@Test(expected = IpdataException.class)
200+
public void testCurrencyError() {
201+
URL url = new URL("https://api.ipdata.co");
202+
IpdataService serviceWithInvalidKey = Ipdata.builder().url(url)
203+
.key("THIS_IS_AN_INVALID_KEY")
204+
.withDefaultCache()
205+
.feignClient(new ApacheHttpClient(HttpClientBuilder.create()
206+
.setSSLHostnameVerifier(new NoopHostnameVerifier()).setConnectionTimeToLive(10, TimeUnit.SECONDS)
207+
.build())).get();
208+
serviceWithInvalidKey.currency("8.8.8.8");
209+
}
210+
157211
@Parameters
158212
public static Iterable<IpdataService> data() {
159213
init();

0 commit comments

Comments
 (0)