Skip to content

Instantly share code, notes, and snippets.

@gbougeard
Created July 11, 2014 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbougeard/e725df015c8cdb04ca9d to your computer and use it in GitHub Desktop.
Save gbougeard/e725df015c8cdb04ca9d to your computer and use it in GitHub Desktop.
public class UserMock {
/**
* Create instance {@Link User}
*
* @param custid
* @param hotelid
* @since 1.0
*/
public final static User createUser(Integer custid,
Integer hotelid) {
User user = new User();
user.setCustid(custid);
user.setHotelid(hotelid);
return user;
}
/**
* @param user {@Link User}
* @param type
* @link Constants#CUSTOMER_LOGINTYPE} @see {@link Constants#HOTELIER_LOGINTYPE}
* @return {@Link User}
* @since 1.0
*/
private final static User setType(User user,
String type) {
user = Preconditions.checkNotNull(user, "user is null");
user.setType(type);
return user;
}
/**
* @link Constants#CUSTOMER_LOGINTYPE}
* @param user
* {@Link User}
* @return {@Link User}
* @since 1.0
*/
public final static void setTypeCustomer(User user) {
UserMock.setType(user, Constants.CUSTOMER_LOGINTYPE);
}
/**
* @link Constants#CUSTOMER_LOGINTYPE}
* @param user
* {@Link User}
* @return {@Link User}
* @since 1.0
*/
public final static void setTypeDistrib(User user) {
UserMock.setType(user, Constants.DISTRIB_LOGINTYPE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment