Skip to content

Commit

Permalink
test(Discovery): Fix fragile integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatino10 committed Jan 24, 2019
1 parent 6b7b10b commit e1ce174
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,13 @@ public void stopwordListOperationsAreSuccessful() throws FileNotFoundException,
public void gatewayOperationsAreSuccessful() {
String gatewayName = "java-sdk-test-gateway";

ListGatewaysOptions listGatewaysOptions = new ListGatewaysOptions.Builder()
.environmentId(environmentId)
.build();
GatewayList gatewayList = discovery.listGateways(listGatewaysOptions).execute();
assertNotNull(gatewayList);
int originalListSize = gatewayList.getGateways().size();

CreateGatewayOptions createGatewayOptions = new CreateGatewayOptions.Builder()
.environmentId(environmentId)
.name(gatewayName)
Expand All @@ -2020,12 +2027,8 @@ public void gatewayOperationsAreSuccessful() {
assertEquals(gatewayName, gatewayResponse.getName());
String testGatewayId = gatewayResponse.getGatewayId();

ListGatewaysOptions listGatewaysOptions = new ListGatewaysOptions.Builder()
.environmentId(environmentId)
.build();
GatewayList gatewayList = discovery.listGateways(listGatewaysOptions).execute();
assertNotNull(gatewayList);
assertTrue(gatewayList.getGateways().size() == 1);
gatewayList = discovery.listGateways(listGatewaysOptions).execute();
assertTrue(gatewayList.getGateways().size() > originalListSize);

GetGatewayOptions getGatewayOptions = new GetGatewayOptions.Builder()
.environmentId(environmentId)
Expand Down

0 comments on commit e1ce174

Please sign in to comment.