Skip to content

Commit bacca49

Browse files
authored
Release/1.0.2 (#8)
* Add test grouping and update README
1 parent 73d7512 commit bacca49

18 files changed

+217
-64
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Description: Reloadly Java SDK for sending Airtime Topups to over 4 billion mobile phones.
66
Author: Reloadly
77
-->
8-
8+
99
# Reloadly SDK for Java
1010

1111
[![CircleCI][circle-ci-badge]][circle-ci-url]
@@ -125,6 +125,28 @@ You can also refer to the [online Javadoc][javadoc].
125125
The library uses [Project Lombok][lombok]. While it is not a requirement, you might want to install
126126
a [plugin][lombok-plugins] for your favorite IDE to facilitate development.
127127

128+
## Running Tests
129+
130+
There are 3 groups of tests : `integration`, `integration-with-proxy` and all test.
131+
132+
* To run all the tests, including integration tests, execute `./mvnw test`. However, for integration tests to run
133+
successfully, the following environment variables are required :
134+
135+
```
136+
export LIVE_CLIENT_ID=put_your_account_live_client_id_here
137+
export LIVE_CLIENT_SECRET=put_your_account_live_client_secret_here
138+
export SANDBOX_CLIENT_ID=put_your_account_sandbox_client_id_here
139+
export SANDBOX_CLIENT_SECRET=put_your_account_sandbox_client_secret_here
140+
export PROXY_HOST=put_your_proxy_host_here
141+
export PROXY_USERNAME=put_your_proxy_username_here
142+
export PROXY_PASSWORD=put_your_proxy_password_here
143+
export PROXY_PORT=put_your_proxy_port_here
144+
```
145+
146+
* To run all integration tests only, execute `./mvnw test -Dgroups=integration`
147+
148+
* To run all proxy integration tests only, execute `./mvnw test -Dgroups=integration-with-proxy`
149+
128150
## Giving Feedback
129151

130152
We need your help in making this SDK great. Please participate in the community and contribute to this effort by

java-sdk-airtime/src/test/java/software/reloadly/sdk/airtime/client/integration/AirtimeAPITest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import software.reloadly.sdk.airtime.dto.response.Operator;
77
import software.reloadly.sdk.airtime.util.ExpiredToken;
88
import software.reloadly.sdk.core.enums.Environment;
9-
import software.reloadly.sdk.core.enums.Service;
109
import software.reloadly.sdk.core.exception.ReloadlyException;
1110
import software.reloadly.sdk.core.internal.dto.request.interfaces.Request;
1211

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package software.reloadly.sdk.airtime.interfaces;
2+
3+
import org.junit.jupiter.api.Tag;
4+
import org.junit.jupiter.api.Test;
5+
6+
import java.lang.annotation.ElementType;
7+
import java.lang.annotation.Retention;
8+
import java.lang.annotation.RetentionPolicy;
9+
import java.lang.annotation.Target;
10+
11+
@Test
12+
@Tag("integration")
13+
@Target(ElementType.METHOD)
14+
@Retention(RetentionPolicy.RUNTIME)
15+
public @interface IntegrationTest {
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package software.reloadly.sdk.airtime.interfaces;
2+
3+
import org.junit.jupiter.api.Tag;
4+
import org.junit.jupiter.api.Test;
5+
6+
import java.lang.annotation.ElementType;
7+
import java.lang.annotation.Retention;
8+
import java.lang.annotation.RetentionPolicy;
9+
import java.lang.annotation.Target;
10+
11+
@Test
12+
@Tag("integration-with-proxy")
13+
@Target(ElementType.METHOD)
14+
@Retention(RetentionPolicy.RUNTIME)
15+
public @interface IntegrationTestWithProxy {
16+
}

java-sdk-airtime/src/test/java/software/reloadly/sdk/airtime/operation/integration/AccountOperationsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package software.reloadly.sdk.airtime.operation.integration;
22

3-
import org.junit.jupiter.api.Test;
43
import software.reloadly.sdk.airtime.client.AirtimeAPI;
54
import software.reloadly.sdk.airtime.dto.response.AccountBalanceInfo;
5+
import software.reloadly.sdk.airtime.interfaces.IntegrationTest;
66
import software.reloadly.sdk.core.enums.Environment;
77
import software.reloadly.sdk.core.internal.dto.request.interfaces.Request;
88

@@ -14,7 +14,7 @@
1414

1515
public class AccountOperationsTest extends BaseIntegrationTest {
1616

17-
@Test
17+
@IntegrationTest
1818
public void testGetAccountBalance() throws Exception {
1919

2020
AirtimeAPI airtimeAPI = AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();

java-sdk-airtime/src/test/java/software/reloadly/sdk/airtime/operation/integration/CountryOperationsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package software.reloadly.sdk.airtime.operation.integration;
22

33
import com.neovisionaries.i18n.CountryCode;
4-
import org.junit.jupiter.api.Test;
54
import software.reloadly.sdk.airtime.client.AirtimeAPI;
65
import software.reloadly.sdk.airtime.dto.response.Country;
6+
import software.reloadly.sdk.airtime.interfaces.IntegrationTest;
77
import software.reloadly.sdk.core.enums.Environment;
88
import software.reloadly.sdk.core.internal.dto.request.interfaces.Request;
99

@@ -15,7 +15,7 @@
1515

1616
public class CountryOperationsTest extends BaseIntegrationTest {
1717

18-
@Test
18+
@IntegrationTest
1919
public void testListCountries() throws Exception {
2020

2121
AirtimeAPI airtimeAPI = AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -26,7 +26,7 @@ public void testListCountries() throws Exception {
2626
countries.forEach(this::assertIsValidCountry);
2727
}
2828

29-
@Test
29+
@IntegrationTest
3030
public void testGetByCountryCode() throws Exception {
3131

3232
AirtimeAPI airtimeAPI = AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();

java-sdk-airtime/src/test/java/software/reloadly/sdk/airtime/operation/integration/DiscountOperationsTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package software.reloadly.sdk.airtime.operation.integration;
22

3-
import org.junit.jupiter.api.Test;
43
import software.reloadly.sdk.airtime.client.AirtimeAPI;
54
import software.reloadly.sdk.airtime.dto.response.Discount;
5+
import software.reloadly.sdk.airtime.interfaces.IntegrationTest;
66
import software.reloadly.sdk.core.dto.response.Page;
77
import software.reloadly.sdk.core.enums.Environment;
88
import software.reloadly.sdk.core.internal.dto.request.interfaces.Request;
@@ -16,7 +16,7 @@
1616

1717
public class DiscountOperationsTest extends BaseIntegrationTest {
1818

19-
@Test
19+
@IntegrationTest
2020
public void testListDiscounts() throws Exception {
2121

2222
AirtimeAPI airtimeAPI =AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -26,7 +26,7 @@ public void testListDiscounts() throws Exception {
2626
discountPage.getContent().forEach(this::assertIsValidDiscount);
2727
}
2828

29-
@Test
29+
@IntegrationTest
3030
public void testListDiscountsWithFilters() throws Exception {
3131

3232
AirtimeAPI airtimeAPI =AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -37,7 +37,7 @@ public void testListDiscountsWithFilters() throws Exception {
3737
discountPage.getContent().forEach(this::assertIsValidDiscount);
3838
}
3939

40-
@Test
40+
@IntegrationTest
4141
public void testGetByOperatorId() throws Exception {
4242

4343
Long operatorId = 174L;

java-sdk-airtime/src/test/java/software/reloadly/sdk/airtime/operation/integration/OperatorOperationsTest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import com.neovisionaries.i18n.CountryCode;
44
import org.junit.jupiter.api.Assertions;
5-
import org.junit.jupiter.api.Test;
65
import software.reloadly.sdk.airtime.client.AirtimeAPI;
76
import software.reloadly.sdk.airtime.dto.response.GeographicalRechargePlan;
87
import software.reloadly.sdk.airtime.dto.response.Operator;
98
import software.reloadly.sdk.airtime.dto.response.OperatorFxRate;
109
import software.reloadly.sdk.airtime.filter.OperatorFilter;
10+
import software.reloadly.sdk.airtime.interfaces.IntegrationTest;
11+
import software.reloadly.sdk.airtime.interfaces.IntegrationTestWithProxy;
1112
import software.reloadly.sdk.core.dto.response.Page;
1213
import software.reloadly.sdk.core.enums.Environment;
1314
import software.reloadly.sdk.core.exception.ReloadlyException;
@@ -31,7 +32,7 @@
3132

3233
public class OperatorOperationsTest extends BaseIntegrationTest {
3334

34-
@Test
35+
@IntegrationTest
3536
public void testListOperatorsWithNoFilters() throws Exception {
3637

3738
AirtimeAPI airtimeAPI = AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -41,7 +42,7 @@ public void testListOperatorsWithNoFilters() throws Exception {
4142
operatorsPage.getContent().forEach(this::assertIsValidOperator);
4243
}
4344

44-
@Test
45+
@IntegrationTest
4546
public void testListOperatorsWithFilters() throws Exception {
4647

4748
int page = 1;
@@ -63,7 +64,7 @@ public void testListOperatorsWithFilters() throws Exception {
6364
operatorsPage.getContent().forEach(this::assertIsValidOperator);
6465
}
6566

66-
@Test
67+
@IntegrationTest
6768
public void testListOperatorsByCountryCodeWithNoFilters() throws Exception {
6869

6970
AirtimeAPI airtimeAPI = AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -75,7 +76,7 @@ public void testListOperatorsByCountryCodeWithNoFilters() throws Exception {
7576
operators.forEach(operator -> assertThat(operator.getSuggestedAmountsMap(), is(anEmptyMap())));
7677
}
7778

78-
@Test
79+
@IntegrationTest
7980
public void testListOperatorsByCountryCodeWithFilters() throws Exception {
8081

8182
AirtimeAPI airtimeAPI = AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -92,7 +93,7 @@ public void testListOperatorsByCountryCodeWithFilters() throws Exception {
9293
});
9394
}
9495

95-
@Test
96+
@IntegrationTest
9697
public void testGetOperatorByIdWithNoFilters() throws Exception {
9798

9899
Long operatorId = 174L;
@@ -106,7 +107,7 @@ public void testGetOperatorByIdWithNoFilters() throws Exception {
106107
assertThat(operator.getSuggestedAmountsMap(), is(anEmptyMap()));
107108
}
108109

109-
@Test
110+
@IntegrationTest
110111
public void testGetOperatorByIdWithFilters() throws Exception {
111112

112113
Long operatorId = 174L;
@@ -121,7 +122,7 @@ public void testGetOperatorByIdWithFilters() throws Exception {
121122
assertThat(operator.getSuggestedAmountsMap(), not(anEmptyMap()));
122123
}
123124

124-
@Test
125+
@IntegrationTest
125126
public void testAutoDetectOperatorWithNoFilters() throws Exception {
126127

127128
String phone = "+50936377111";
@@ -134,7 +135,7 @@ public void testAutoDetectOperatorWithNoFilters() throws Exception {
134135
assertThat(operator.getSuggestedAmountsMap(), anEmptyMap());
135136
}
136137

137-
@Test
138+
@IntegrationTest
138139
public void testAutoDetectOperatorWithFilters() throws Exception {
139140

140141
String phone = "+50936377111";
@@ -148,7 +149,7 @@ public void testAutoDetectOperatorWithFilters() throws Exception {
148149
assertThat(operator.getSuggestedAmountsMap(), not(anEmptyMap()));
149150
}
150151

151-
@Test
152+
@IntegrationTest
152153
public void testCalculateOperatorFxRate() throws Exception {
153154

154155
Double amount = 5.00;
@@ -164,7 +165,7 @@ public void testCalculateOperatorFxRate() throws Exception {
164165
assertThat(operatorFxRate.getOperatorId(), equalTo(operatorId));
165166
}
166167

167-
@Test
168+
@IntegrationTest
168169
public void testGetOperatorByIdWithGeographicalRechargePlan() throws Exception {
169170

170171
Long operatorId = 200L;
@@ -198,7 +199,7 @@ public void testGetOperatorByIdWithGeographicalRechargePlan() throws Exception {
198199
});
199200
}
200201

201-
@Test
202+
@IntegrationTestWithProxy
202203
public void testRequestWithProxyAuthentication() throws ReloadlyException {
203204

204205
String host = System.getenv("PROXY_HOST");
@@ -223,8 +224,8 @@ public void testRequestWithProxyAuthentication() throws ReloadlyException {
223224
assertThat(operator, is(notNullValue()));
224225
}
225226

226-
@Test
227-
public void testRequestWithoutProxyAuthentication() {
227+
@IntegrationTestWithProxy
228+
public void testRequestWithUnAuthenticatedProxy() {
228229

229230
String host = System.getenv("PROXY_HOST");
230231
int port = Integer.parseInt(System.getenv("PROXY_PORT"));

java-sdk-airtime/src/test/java/software/reloadly/sdk/airtime/operation/integration/PromotionOperationsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package software.reloadly.sdk.airtime.operation.integration;
22

33
import com.neovisionaries.i18n.CountryCode;
4-
import org.junit.jupiter.api.Test;
54
import software.reloadly.sdk.airtime.client.AirtimeAPI;
65
import software.reloadly.sdk.airtime.dto.response.Promotion;
6+
import software.reloadly.sdk.airtime.interfaces.IntegrationTest;
77
import software.reloadly.sdk.core.dto.response.Page;
88
import software.reloadly.sdk.core.enums.Environment;
99
import software.reloadly.sdk.core.internal.dto.request.interfaces.Request;
@@ -17,7 +17,7 @@
1717

1818
public class PromotionOperationsTest extends BaseIntegrationTest {
1919

20-
@Test
20+
@IntegrationTest
2121
public void testListPromotionsWithNoFilters() throws Exception {
2222

2323
AirtimeAPI airtimeAPI =AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -28,7 +28,7 @@ public void testListPromotionsWithNoFilters() throws Exception {
2828
promotionPage.getContent().forEach(this::assertIsValidPromotion);
2929
}
3030

31-
@Test
31+
@IntegrationTest
3232
public void testListPromotionsWithFilters() throws Exception {
3333

3434
AirtimeAPI airtimeAPI =AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -43,7 +43,7 @@ public void testListPromotionsWithFilters() throws Exception {
4343
promotionPage.getContent().forEach(this::assertIsValidPromotion);
4444
}
4545

46-
@Test
46+
@IntegrationTest
4747
public void testGetById() throws Exception {
4848

4949
AirtimeAPI airtimeAPI =AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -61,7 +61,7 @@ public void testGetById() throws Exception {
6161
assertIsValidPromotion(promotion);
6262
}
6363

64-
@Test
64+
@IntegrationTest
6565
public void testGetByCountryCode() throws Exception {
6666

6767
AirtimeAPI airtimeAPI =AirtimeAPI.builder().environment(Environment.LIVE).accessToken(accessToken).build();
@@ -72,7 +72,7 @@ public void testGetByCountryCode() throws Exception {
7272
promotions.forEach(this::assertIsValidPromotion);
7373
}
7474

75-
@Test
75+
@IntegrationTest
7676
public void testGetByOperatorId() throws Exception {
7777

7878
Long operatorId = 173L;

0 commit comments

Comments
 (0)