Skip to content

Commit

Permalink
Some minor formatting changes. (bunq#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Jun 20, 2018
1 parent 0d7cae4 commit 61dee09
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/bunq/sdk/context/SessionContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ Date getExpiryTime() {
public Integer getUserId() {
return userId;
}
}

}
4 changes: 1 addition & 3 deletions src/main/java/com/bunq/sdk/context/UserContext.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package com.bunq.sdk.context;

import com.bunq.sdk.exception.BunqException;
import com.bunq.sdk.model.core.BunqModel;
import com.bunq.sdk.model.core.UserContextHelper;
import com.bunq.sdk.model.generated.endpoint.MonetaryAccountBank;
import com.bunq.sdk.model.generated.endpoint.User;
import com.bunq.sdk.model.generated.endpoint.UserCompany;
import com.bunq.sdk.model.generated.endpoint.UserPerson;

import java.util.List;

public class UserContext {

/**
Expand Down Expand Up @@ -83,4 +80,5 @@ public UserCompany getUserCompany() {
public MonetaryAccountBank getPrimaryMonetaryAccountBank() {
return this.primaryMonetaryAccountBank;
}

}
8 changes: 4 additions & 4 deletions src/main/java/com/bunq/sdk/model/core/UserContextHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public User getFirstUser() {

public MonetaryAccountBank getFirstActiveMonetaryAccountBankByUserId(Integer userId) {
BunqResponseRaw responseRaw = getRawResponse(
String.format(ENDPOINT_MONETARY_ACCOUNT_BANK, userId)
String.format(ENDPOINT_MONETARY_ACCOUNT_BANK, userId)
);
String wrapper = MonetaryAccountBank.class.getSimpleName();
BunqResponse<List<MonetaryAccountBank>> response = fromJsonList(
MonetaryAccountBank.class, responseRaw, wrapper
MonetaryAccountBank.class, responseRaw, wrapper
);

for (MonetaryAccountBank monetaryAccountBank:response.getValue()) {
for (MonetaryAccountBank monetaryAccountBank : response.getValue()) {
if (STATUS_ACTIVE.equals(monetaryAccountBank.getStatus())) {
return monetaryAccountBank;
}
Expand All @@ -71,5 +71,5 @@ public MonetaryAccountBank getFirstActiveMonetaryAccountBankByUserId(Integer use
public boolean isAllFieldNull() {
return true;
}
}

}
17 changes: 8 additions & 9 deletions src/test/java/com/bunq/sdk/context/UserContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
import static org.junit.Assert.assertNotNull;

public class UserContextTest extends BunqSdkTestBase {

@Test
public void buildUserContext() {
ApiContext context = getApiContext();

UserContext userContext = new UserContext(context);
@Test
public void buildUserContext() {
ApiContext context = getApiContext();

assertNotNull(userContext.getUserId());
assertNotNull(userContext.getMainMonetaryAccountId());
}
}
UserContext userContext = new UserContext(context);

assertNotNull(userContext.getUserId());
assertNotNull(userContext.getMainMonetaryAccountId());
}

}

0 comments on commit 61dee09

Please sign in to comment.