Commit 1bf04377561b74df5010813d921c461821bec3d1

Authored by Chris Eykamp
1 parent 96c9dbd6

Rename function so tests pass

@@ -56,7 +56,7 @@ public class CustomerController extends BaseController { @@ -56,7 +56,7 @@ public class CustomerController extends BaseController {
56 ObjectMapper objectMapper = new ObjectMapper(); 56 ObjectMapper objectMapper = new ObjectMapper();
57 ObjectNode infoObject = objectMapper.createObjectNode(); 57 ObjectNode infoObject = objectMapper.createObjectNode();
58 infoObject.put("title", customer.getTitle()); 58 infoObject.put("title", customer.getTitle());
59 - infoObject.put("isPublic", customer.isPublic()); 59 + infoObject.put("isPublic", customer.publicCustomer());
60 return infoObject; 60 return infoObject;
61 } catch (Exception e) { 61 } catch (Exception e) {
62 throw handleException(e); 62 throw handleException(e);
@@ -104,7 +104,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide @@ -104,7 +104,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide
104 throw new UsernameNotFoundException("Public entity not found by refresh token"); 104 throw new UsernameNotFoundException("Public entity not found by refresh token");
105 } 105 }
106 106
107 - if (!publicCustomer.isPublic()) { 107 + if (!publicCustomer.publicCustomer()) {
108 throw new BadCredentialsException("Refresh token is not valid"); 108 throw new BadCredentialsException("Refresh token is not valid");
109 } 109 }
110 110
@@ -108,7 +108,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { @@ -108,7 +108,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider {
108 if (publicCustomer == null) { 108 if (publicCustomer == null) {
109 throw new UsernameNotFoundException("Public entity not found: " + publicId); 109 throw new UsernameNotFoundException("Public entity not found: " + publicId);
110 } 110 }
111 - if (!publicCustomer.isPublic()) { 111 + if (!publicCustomer.publicCustomer()) {
112 throw new BadCredentialsException("Authentication Failed. Public Id is not valid."); 112 throw new BadCredentialsException("Authentication Failed. Public Id is not valid.");
113 } 113 }
114 User user = new User(new UserId(UUIDBased.EMPTY)); 114 User user = new User(new UserId(UUIDBased.EMPTY));
@@ -60,8 +60,8 @@ public class Customer extends ContactBased<CustomerId> implements HasName { @@ -60,8 +60,8 @@ public class Customer extends ContactBased<CustomerId> implements HasName {
60 public void setTitle(String title) { 60 public void setTitle(String title) {
61 this.title = title; 61 this.title = title;
62 } 62 }
63 -  
64 - public boolean isPublic() { 63 +
  64 + public boolean publicCustomer() { // Using better name isPublic causes tests to fail
65 if (getAdditionalInfo() != null && getAdditionalInfo().has("isPublic")) { 65 if (getAdditionalInfo() != null && getAdditionalInfo().has("isPublic")) {
66 return getAdditionalInfo().get("isPublic").asBoolean(); 66 return getAdditionalInfo().get("isPublic").asBoolean();
67 } 67 }