@Test public void shouldReturnOriginalUIDIfCustomerIdIsNotSet() throws Exception { when(customerModelMock.getCustomerID()).thenReturn(""); when(customerModelMock.getOriginalUid()).thenReturn(ORIGINAL_UID); final String result = testObj.getAuthenticatedShopperId(customerModelMock); assertEquals(ORIGINAL_UID, result); }
@Override public String getAuthenticatedShopperId(final UserModel userModel) { Preconditions.checkNotNull(userModel, "The user is null"); if (userModel instanceof CustomerModel) { final String customerID = ((CustomerModel) userModel).getCustomerID(); return StringUtils.defaultIfBlank(customerID, ((CustomerModel) userModel).getOriginalUid()); } throw new IllegalArgumentException(format("The user {0} is not of type Customer.", userModel)); }
DefaultWorldpayAuthenticatedShopperIdStrategy implements WorldpayAuthenticatedShopperIdStrategy { @Override public String getAuthenticatedShopperId(final UserModel userModel) { Preconditions.checkNotNull(userModel, "The user is null"); if (userModel instanceof CustomerModel) { final String customerID = ((CustomerModel) userModel).getCustomerID(); return StringUtils.defaultIfBlank(customerID, ((CustomerModel) userModel).getOriginalUid()); } throw new IllegalArgumentException(format("The user {0} is not of type Customer.", userModel)); } }
DefaultWorldpayAuthenticatedShopperIdStrategy implements WorldpayAuthenticatedShopperIdStrategy { @Override public String getAuthenticatedShopperId(final UserModel userModel) { Preconditions.checkNotNull(userModel, "The user is null"); if (userModel instanceof CustomerModel) { final String customerID = ((CustomerModel) userModel).getCustomerID(); return StringUtils.defaultIfBlank(customerID, ((CustomerModel) userModel).getOriginalUid()); } throw new IllegalArgumentException(format("The user {0} is not of type Customer.", userModel)); }  }
DefaultWorldpayAuthenticatedShopperIdStrategy implements WorldpayAuthenticatedShopperIdStrategy { @Override public String getAuthenticatedShopperId(final UserModel userModel) { Preconditions.checkNotNull(userModel, "The user is null"); if (userModel instanceof CustomerModel) { final String customerID = ((CustomerModel) userModel).getCustomerID(); return StringUtils.defaultIfBlank(customerID, ((CustomerModel) userModel).getOriginalUid()); } throw new IllegalArgumentException(format("The user {0} is not of type Customer.", userModel)); }  @Override String getAuthenticatedShopperId(final UserModel userModel); }
DefaultWorldpayAuthenticatedShopperIdStrategy implements WorldpayAuthenticatedShopperIdStrategy { @Override public String getAuthenticatedShopperId(final UserModel userModel) { Preconditions.checkNotNull(userModel, "The user is null"); if (userModel instanceof CustomerModel) { final String customerID = ((CustomerModel) userModel).getCustomerID(); return StringUtils.defaultIfBlank(customerID, ((CustomerModel) userModel).getOriginalUid()); } throw new IllegalArgumentException(format("The user {0} is not of type Customer.", userModel)); }  @Override String getAuthenticatedShopperId(final UserModel userModel);  }