target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test public void testLogin() throws AVException { AVUser user = AVUser.logIn(DEFAULT_TEST_USER_NAME, DEFAULT_TEST_USER_PWD); Assert.assertEquals(user.getUsername(), DEFAULT_TEST_USER_NAME); Assert.assertNotNull(user.getSessionToken()); Assert.assertEquals(user.get(DEFAULT_TEST_USER_CUSTOM_KEY), DEFAULT_TEST_USER_CUSTOM_VALUE); } | public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testLogInInBackground() { final CountDownLatch latch = new CountDownLatch(1); AVUser.logInInBackground(DEFAULT_TEST_USER_NAME, DEFAULT_TEST_USER_PWD, new LogInCallback<AVUser>() { @Override public void done(AVUser user, AVException e) { Assert.assertNull(e); Assert.assertEquals(user.getUsername(), DEFAULT_TEST_USER_NAME); Assert.assertNotNull(user.getSessionToken()); Assert.assertEquals(user.get(DEFAULT_TEST_USER_CUSTOM_KEY), DEFAULT_TEST_USER_CUSTOM_VALUE); latch.countDown(); } }); } | public static void logInInBackground(String username, String password, LogInCallback<AVUser> callback) { logInInBackground(username, password, callback, AVUser.class); } | AVUser extends AVObject { public static void logInInBackground(String username, String password, LogInCallback<AVUser> callback) { logInInBackground(username, password, callback, AVUser.class); } } | AVUser extends AVObject { public static void logInInBackground(String username, String password, LogInCallback<AVUser> callback) { logInInBackground(username, password, callback, AVUser.class); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public static void logInInBackground(String username, String password, LogInCallback<AVUser> callback) { logInInBackground(username, password, callback, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public static void logInInBackground(String username, String password, LogInCallback<AVUser> callback) { logInInBackground(username, password, callback, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testBecomeWithSessionToken() throws AVException { AVUser user = AVUser.logIn(DEFAULT_TEST_USER_NAME, DEFAULT_TEST_USER_PWD); AVUser newUser = AVUser.becomeWithSessionToken(user.getSessionToken()); Assert.assertEquals(user, newUser); } | public static AVUser becomeWithSessionToken(String sessionToken) throws AVException { return becomeWithSessionToken(sessionToken, AVUser.class); } | AVUser extends AVObject { public static AVUser becomeWithSessionToken(String sessionToken) throws AVException { return becomeWithSessionToken(sessionToken, AVUser.class); } } | AVUser extends AVObject { public static AVUser becomeWithSessionToken(String sessionToken) throws AVException { return becomeWithSessionToken(sessionToken, AVUser.class); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public static AVUser becomeWithSessionToken(String sessionToken) throws AVException { return becomeWithSessionToken(sessionToken, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public static AVUser becomeWithSessionToken(String sessionToken) throws AVException { return becomeWithSessionToken(sessionToken, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testGetRoles() throws AVException { AVUser user = AVUser.logIn(DEFAULT_TEST_USER_NAME, DEFAULT_TEST_USER_PWD); AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, user); List<AVRole> roleList = roleQuery.find(); Assert.assertNotNull(roleList); Assert.assertTrue(roleList.size() > 0); } | @JSONField(serialize = false) public List<AVRole> getRoles() throws AVException { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, this); return roleQuery.find(); } | AVUser extends AVObject { @JSONField(serialize = false) public List<AVRole> getRoles() throws AVException { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, this); return roleQuery.find(); } } | AVUser extends AVObject { @JSONField(serialize = false) public List<AVRole> getRoles() throws AVException { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, this); return roleQuery.find(); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { @JSONField(serialize = false) public List<AVRole> getRoles() throws AVException { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, this); return roleQuery.find(); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { @JSONField(serialize = false) public List<AVRole> getRoles() throws AVException { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, this); return roleQuery.find(); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void getRolesInBackground() throws Exception { AVUser user = AVUser.logIn(DEFAULT_TEST_USER_NAME, DEFAULT_TEST_USER_PWD); AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUser.AVUSER_ENDPOINT, user); final CountDownLatch latch = new CountDownLatch(1); roleQuery.findInBackground(new FindCallback<AVRole>() { @Override public void done(List<AVRole> avObjects, AVException avException) { Assert.assertNotNull(avObjects); Assert.assertTrue(avObjects.size() > 0); latch.countDown(); } }); } | public void getRolesInBackground(final AVCallback<List<AVRole>> callback) { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUSER_ENDPOINT, this); roleQuery.findInBackground(new FindCallback<AVRole>() { @Override public void done(List<AVRole> list, AVException e) { callback.internalDone(list, e); } }); } | AVUser extends AVObject { public void getRolesInBackground(final AVCallback<List<AVRole>> callback) { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUSER_ENDPOINT, this); roleQuery.findInBackground(new FindCallback<AVRole>() { @Override public void done(List<AVRole> list, AVException e) { callback.internalDone(list, e); } }); } } | AVUser extends AVObject { public void getRolesInBackground(final AVCallback<List<AVRole>> callback) { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUSER_ENDPOINT, this); roleQuery.findInBackground(new FindCallback<AVRole>() { @Override public void done(List<AVRole> list, AVException e) { callback.internalDone(list, e); } }); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public void getRolesInBackground(final AVCallback<List<AVRole>> callback) { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUSER_ENDPOINT, this); roleQuery.findInBackground(new FindCallback<AVRole>() { @Override public void done(List<AVRole> list, AVException e) { callback.internalDone(list, e); } }); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public void getRolesInBackground(final AVCallback<List<AVRole>> callback) { AVQuery<AVRole> roleQuery = new AVQuery<AVRole>(AVRole.className); roleQuery.whereEqualTo(AVUSER_ENDPOINT, this); roleQuery.findInBackground(new FindCallback<AVRole>() { @Override public void done(List<AVRole> list, AVException e) { callback.internalDone(list, e); } }); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testRefreshSessionToken() throws AVException { AVUser.alwaysUseSubUserClass(ChildAVUser.class); AVUser.registerSubclass(ChildAVUser.class); AVUser user = AVUser.logIn(DEFAULT_TEST_USER_NAME, DEFAULT_TEST_USER_PWD, ChildAVUser.class); AVUser newUser = user.refreshSessionToken(); Assert.assertNotNull(newUser.getSessionToken()); Assert.assertTrue(!newUser.getSessionToken().equals(user.getSessionToken())); } | public <T extends AVUser> T refreshSessionToken() { final ArrayList<T> arrayList = new ArrayList<>(); refreshSessionToken(true, new LogInCallback<T>(){ @Override public void done(T user, AVException e) { if (e != null) { AVExceptionHolder.add(e); } else { arrayList.add(user); } } }); return arrayList.get(0); } | AVUser extends AVObject { public <T extends AVUser> T refreshSessionToken() { final ArrayList<T> arrayList = new ArrayList<>(); refreshSessionToken(true, new LogInCallback<T>(){ @Override public void done(T user, AVException e) { if (e != null) { AVExceptionHolder.add(e); } else { arrayList.add(user); } } }); return arrayList.get(0); } } | AVUser extends AVObject { public <T extends AVUser> T refreshSessionToken() { final ArrayList<T> arrayList = new ArrayList<>(); refreshSessionToken(true, new LogInCallback<T>(){ @Override public void done(T user, AVException e) { if (e != null) { AVExceptionHolder.add(e); } else { arrayList.add(user); } } }); return arrayList.get(0); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public <T extends AVUser> T refreshSessionToken() { final ArrayList<T> arrayList = new ArrayList<>(); refreshSessionToken(true, new LogInCallback<T>(){ @Override public void done(T user, AVException e) { if (e != null) { AVExceptionHolder.add(e); } else { arrayList.add(user); } } }); return arrayList.get(0); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public <T extends AVUser> T refreshSessionToken() { final ArrayList<T> arrayList = new ArrayList<>(); refreshSessionToken(true, new LogInCallback<T>(){ @Override public void done(T user, AVException e) { if (e != null) { AVExceptionHolder.add(e); } else { arrayList.add(user); } } }); return arrayList.get(0); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testRequestCaptchaInBackground() throws AVException { final CountDownLatch latch = new CountDownLatch(1); AVCaptchaOption option = new AVCaptchaOption(); option.setWidth(200); option.setHeight(100); AVCaptcha.requestCaptchaInBackground(option, new AVCallback<AVCaptchaDigest>() { @Override protected void internalDone0(AVCaptchaDigest avCaptchaDigest, AVException exception) { Assert.assertNull(exception); Assert.assertNotNull(avCaptchaDigest); Assert.assertNotNull(avCaptchaDigest.getNonce()); Assert.assertNotNull(avCaptchaDigest.getUrl()); latch.countDown(); } @Override protected boolean mustRunOnUIThread() { return false; } }); try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } } | public static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback) { if (null == callback) { return; } PaasClient.storageInstance().getObject("requestCaptcha", getOptionParams(option), false, null, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { AVCaptchaDigest digest = new AVCaptchaDigest(); if (!AVUtils.isBlankString(content)) { Map<String, String> map = JSON.parseObject(content, HashMap.class); if (null != map) { if (map.containsKey(CAPTCHA_TOKEN)) { digest.setNonce(map.get(CAPTCHA_TOKEN)); } if (map.containsKey(CAPTCHA_URL)) { digest.setUrl(map.get(CAPTCHA_URL)); } } } callback.internalDone(digest, null); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } }); } | AVCaptcha { public static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback) { if (null == callback) { return; } PaasClient.storageInstance().getObject("requestCaptcha", getOptionParams(option), false, null, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { AVCaptchaDigest digest = new AVCaptchaDigest(); if (!AVUtils.isBlankString(content)) { Map<String, String> map = JSON.parseObject(content, HashMap.class); if (null != map) { if (map.containsKey(CAPTCHA_TOKEN)) { digest.setNonce(map.get(CAPTCHA_TOKEN)); } if (map.containsKey(CAPTCHA_URL)) { digest.setUrl(map.get(CAPTCHA_URL)); } } } callback.internalDone(digest, null); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } }); } } | AVCaptcha { public static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback) { if (null == callback) { return; } PaasClient.storageInstance().getObject("requestCaptcha", getOptionParams(option), false, null, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { AVCaptchaDigest digest = new AVCaptchaDigest(); if (!AVUtils.isBlankString(content)) { Map<String, String> map = JSON.parseObject(content, HashMap.class); if (null != map) { if (map.containsKey(CAPTCHA_TOKEN)) { digest.setNonce(map.get(CAPTCHA_TOKEN)); } if (map.containsKey(CAPTCHA_URL)) { digest.setUrl(map.get(CAPTCHA_URL)); } } } callback.internalDone(digest, null); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } }); } } | AVCaptcha { public static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback) { if (null == callback) { return; } PaasClient.storageInstance().getObject("requestCaptcha", getOptionParams(option), false, null, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { AVCaptchaDigest digest = new AVCaptchaDigest(); if (!AVUtils.isBlankString(content)) { Map<String, String> map = JSON.parseObject(content, HashMap.class); if (null != map) { if (map.containsKey(CAPTCHA_TOKEN)) { digest.setNonce(map.get(CAPTCHA_TOKEN)); } if (map.containsKey(CAPTCHA_URL)) { digest.setUrl(map.get(CAPTCHA_URL)); } } } callback.internalDone(digest, null); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } }); } static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback); static void verifyCaptchaCodeInBackground(String captchaCode, AVCaptchaDigest digest, final AVCallback<String> callback); } | AVCaptcha { public static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback) { if (null == callback) { return; } PaasClient.storageInstance().getObject("requestCaptcha", getOptionParams(option), false, null, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { AVCaptchaDigest digest = new AVCaptchaDigest(); if (!AVUtils.isBlankString(content)) { Map<String, String> map = JSON.parseObject(content, HashMap.class); if (null != map) { if (map.containsKey(CAPTCHA_TOKEN)) { digest.setNonce(map.get(CAPTCHA_TOKEN)); } if (map.containsKey(CAPTCHA_URL)) { digest.setUrl(map.get(CAPTCHA_URL)); } } } callback.internalDone(digest, null); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } }); } static void requestCaptchaInBackground(AVCaptchaOption option, final AVCallback<AVCaptchaDigest> callback); static void verifyCaptchaCodeInBackground(String captchaCode, AVCaptchaDigest digest, final AVCallback<String> callback); } |
@Test public void testAVObjectDeserialize() { String data = "{\n" + " \"image\": {\n" + " \"bucket\": \"xtuccgoj\",\n" + " \"metaData\": {\n" + " \"owner\": \"unknown\",\n" + " \"size\": 12382\n" + " },\n" + " \"createdAt\": \"2019-06-22T07:18:09.584Z\",\n" + " \"mime_type\": \"image/jpeg\",\n" + " \"__type\": \"File\",\n" + " \"name\": \"shop_vip_qq.jpg\",\n" + " \"url\": \"http: " \"objectId\": \"5d0dd631eaa375007402d28a\",\n" + " \"updatedAt\": \"2019-06-22T07:18:09.584Z\"\n" + " },\n" + " \"createdAt\": \"2019-06-22T06:48:28.395Z\",\n" + " \"__type\": \"Object\",\n" + " \"name\": \"腾讯会员月卡\",\n" + " \"end\": \"-1\",\n" + " \"className\": \"ShopItem\",\n" + " \"type\": 1,\n" + " \"value\": 19000,\n" + " \"objectId\": \"5d0dcf3c43e78c0073024a19\",\n" + " \"updatedAt\": \"2019-06-22T12:11:50.924Z\"\n" + "}"; AVObject obj = JSON.parseObject(data, AVObject.class); } | private static Object parseObject(Object object) { if (object == null) { return null; } else if (object instanceof Map) { return getParsedMap((Map<String, Object>) object); } else if (object instanceof Collection) { return getParsedList((Collection) object); } else if (object instanceof AVObject) { return ((AVObject) object).toJSONObject(); } else if (object instanceof AVGeoPoint) { return AVUtils.mapFromGeoPoint((AVGeoPoint) object); } else if (object instanceof Date) { return AVUtils.mapFromDate((Date) object); } else if (object instanceof byte[]) { return AVUtils.mapFromByteArray((byte[]) object); } else if (object instanceof AVFile) { return ((AVFile) object).toJSONObject(); } else if (object instanceof org.json.JSONObject) { return JSON.parse(object.toString()); } else if (object instanceof org.json.JSONArray) { return JSON.parse(object.toString()); } else { return object; } } | AVObject implements Parcelable { private static Object parseObject(Object object) { if (object == null) { return null; } else if (object instanceof Map) { return getParsedMap((Map<String, Object>) object); } else if (object instanceof Collection) { return getParsedList((Collection) object); } else if (object instanceof AVObject) { return ((AVObject) object).toJSONObject(); } else if (object instanceof AVGeoPoint) { return AVUtils.mapFromGeoPoint((AVGeoPoint) object); } else if (object instanceof Date) { return AVUtils.mapFromDate((Date) object); } else if (object instanceof byte[]) { return AVUtils.mapFromByteArray((byte[]) object); } else if (object instanceof AVFile) { return ((AVFile) object).toJSONObject(); } else if (object instanceof org.json.JSONObject) { return JSON.parse(object.toString()); } else if (object instanceof org.json.JSONArray) { return JSON.parse(object.toString()); } else { return object; } } } | AVObject implements Parcelable { private static Object parseObject(Object object) { if (object == null) { return null; } else if (object instanceof Map) { return getParsedMap((Map<String, Object>) object); } else if (object instanceof Collection) { return getParsedList((Collection) object); } else if (object instanceof AVObject) { return ((AVObject) object).toJSONObject(); } else if (object instanceof AVGeoPoint) { return AVUtils.mapFromGeoPoint((AVGeoPoint) object); } else if (object instanceof Date) { return AVUtils.mapFromDate((Date) object); } else if (object instanceof byte[]) { return AVUtils.mapFromByteArray((byte[]) object); } else if (object instanceof AVFile) { return ((AVFile) object).toJSONObject(); } else if (object instanceof org.json.JSONObject) { return JSON.parse(object.toString()); } else if (object instanceof org.json.JSONArray) { return JSON.parse(object.toString()); } else { return object; } } AVObject(); AVObject(String theClassName); AVObject(Parcel in); } | AVObject implements Parcelable { private static Object parseObject(Object object) { if (object == null) { return null; } else if (object instanceof Map) { return getParsedMap((Map<String, Object>) object); } else if (object instanceof Collection) { return getParsedList((Collection) object); } else if (object instanceof AVObject) { return ((AVObject) object).toJSONObject(); } else if (object instanceof AVGeoPoint) { return AVUtils.mapFromGeoPoint((AVGeoPoint) object); } else if (object instanceof Date) { return AVUtils.mapFromDate((Date) object); } else if (object instanceof byte[]) { return AVUtils.mapFromByteArray((byte[]) object); } else if (object instanceof AVFile) { return ((AVFile) object).toJSONObject(); } else if (object instanceof org.json.JSONObject) { return JSON.parse(object.toString()); } else if (object instanceof org.json.JSONArray) { return JSON.parse(object.toString()); } else { return object; } } AVObject(); AVObject(String theClassName); AVObject(Parcel in); @Override String toString(); JSONObject toJSONObject(); boolean isFetchWhenSave(); void setFetchWhenSave(boolean fetchWhenSave); String getUuid(); static void registerSubclass(Class<T> clazz); void add(String key, Object value); void addAll(String key, Collection<?> values); static AVQuery<T> getQuery(Class<T> clazz); void addAllUnique(String key, Collection<?> values); void addUnique(String key, Object value); boolean containsKey(String key); static AVObject create(String className); static AVObject parseAVObject(String avObjectString); static AVObject createWithoutData(String className, String objectId); static T createWithoutData(Class<T> clazz, String objectId); void delete(); void delete(AVDeleteOption option); static void deleteAll(Collection<? extends AVObject> objects); static void deleteAllInBackground(Collection<? extends AVObject> objects,
DeleteCallback deleteCallback); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(AVDeleteOption option); void deleteInBackground(AVDeleteOption option, DeleteCallback callback); void deleteInBackground(DeleteCallback callback); AVObject fetch(); AVObject fetch(String includeKeys); static List<AVObject> fetchAll(List<AVObject> objects); static List<AVObject> fetchAllIfNeeded(List<AVObject> objects); static void fetchAllIfNeededInBackground(List<AVObject> objects,
FindCallback<AVObject> callback); static void fetchAllInBackground(List<AVObject> objects,
final FindCallback<AVObject> callback); AVObject fetchIfNeeded(); AVObject fetchIfNeeded(String includeKeys); void fetchIfNeededInBackground(GetCallback<AVObject> callback); void fetchIfNeededInBackground(String includeKeys, GetCallback<AVObject> callback); void fetchInBackground(GetCallback<AVObject> callback); void fetchInBackground(String includeKeys, GetCallback<AVObject> callback); Object get(String key); AVACL getACL(); boolean getBoolean(String key); byte[] getBytes(String key); String getClassName(); Date getCreatedAt(); Date getDate(String key); double getDouble(String key); int getInt(String key); JSONArray getJSONArray(String key); JSONObject getJSONObject(String key); List getList(String key); List<T> getList(String key, Class<T> clazz); long getLong(String key); Map<String, V> getMap(String key); Number getNumber(String key); String getObjectId(); @SuppressWarnings("unchecked") T getAVFile(String key); AVGeoPoint getAVGeoPoint(String key); @SuppressWarnings("unchecked") T getAVObject(String key); T getAVObject(String key, Class<T> clazz); @SuppressWarnings("unchecked") T getAVUser(String key); T getAVUser(String key, Class<T> clazz); AVRelation<T> getRelation(String key); String getString(String key); Date getUpdatedAt(); boolean has(String key); boolean hasSameId(AVObject other); void increment(String key); void increment(final String key, final Number amount); boolean isDataAvailable(); Set<String> keySet(); void put(final String key, final Object value); void refresh(); void refresh(String includeKeys); void refreshInBackground(RefreshCallback<AVObject> callback); void refreshInBackground(String includeKeys, RefreshCallback<AVObject> callback); void remove(String key); void removeAll(final String key, final Collection<?> values); void save(); void save(AVSaveOption option); static void saveAll(List<? extends AVObject> objects); static void saveAllInBackground(List<? extends AVObject> objects); static void saveAllInBackground(List<? extends AVObject> objects, SaveCallback callback); void saveEventually(); void saveEventually(SaveCallback callback); void saveInBackground(); void saveInBackground(AVSaveOption option); void saveInBackground(SaveCallback callback); void saveInBackground(AVSaveOption option, SaveCallback callback); void setACL(AVACL acl); void setObjectId(String newObjectId); static void saveFileBeforeSave(List<AVFile> files, final boolean sync,
final SaveCallback callback); @Override int hashCode(); @Override boolean equals(Object obj); @Override int describeContents(); @Override void writeToParcel(Parcel out, int i); } | AVObject implements Parcelable { private static Object parseObject(Object object) { if (object == null) { return null; } else if (object instanceof Map) { return getParsedMap((Map<String, Object>) object); } else if (object instanceof Collection) { return getParsedList((Collection) object); } else if (object instanceof AVObject) { return ((AVObject) object).toJSONObject(); } else if (object instanceof AVGeoPoint) { return AVUtils.mapFromGeoPoint((AVGeoPoint) object); } else if (object instanceof Date) { return AVUtils.mapFromDate((Date) object); } else if (object instanceof byte[]) { return AVUtils.mapFromByteArray((byte[]) object); } else if (object instanceof AVFile) { return ((AVFile) object).toJSONObject(); } else if (object instanceof org.json.JSONObject) { return JSON.parse(object.toString()); } else if (object instanceof org.json.JSONArray) { return JSON.parse(object.toString()); } else { return object; } } AVObject(); AVObject(String theClassName); AVObject(Parcel in); @Override String toString(); JSONObject toJSONObject(); boolean isFetchWhenSave(); void setFetchWhenSave(boolean fetchWhenSave); String getUuid(); static void registerSubclass(Class<T> clazz); void add(String key, Object value); void addAll(String key, Collection<?> values); static AVQuery<T> getQuery(Class<T> clazz); void addAllUnique(String key, Collection<?> values); void addUnique(String key, Object value); boolean containsKey(String key); static AVObject create(String className); static AVObject parseAVObject(String avObjectString); static AVObject createWithoutData(String className, String objectId); static T createWithoutData(Class<T> clazz, String objectId); void delete(); void delete(AVDeleteOption option); static void deleteAll(Collection<? extends AVObject> objects); static void deleteAllInBackground(Collection<? extends AVObject> objects,
DeleteCallback deleteCallback); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(AVDeleteOption option); void deleteInBackground(AVDeleteOption option, DeleteCallback callback); void deleteInBackground(DeleteCallback callback); AVObject fetch(); AVObject fetch(String includeKeys); static List<AVObject> fetchAll(List<AVObject> objects); static List<AVObject> fetchAllIfNeeded(List<AVObject> objects); static void fetchAllIfNeededInBackground(List<AVObject> objects,
FindCallback<AVObject> callback); static void fetchAllInBackground(List<AVObject> objects,
final FindCallback<AVObject> callback); AVObject fetchIfNeeded(); AVObject fetchIfNeeded(String includeKeys); void fetchIfNeededInBackground(GetCallback<AVObject> callback); void fetchIfNeededInBackground(String includeKeys, GetCallback<AVObject> callback); void fetchInBackground(GetCallback<AVObject> callback); void fetchInBackground(String includeKeys, GetCallback<AVObject> callback); Object get(String key); AVACL getACL(); boolean getBoolean(String key); byte[] getBytes(String key); String getClassName(); Date getCreatedAt(); Date getDate(String key); double getDouble(String key); int getInt(String key); JSONArray getJSONArray(String key); JSONObject getJSONObject(String key); List getList(String key); List<T> getList(String key, Class<T> clazz); long getLong(String key); Map<String, V> getMap(String key); Number getNumber(String key); String getObjectId(); @SuppressWarnings("unchecked") T getAVFile(String key); AVGeoPoint getAVGeoPoint(String key); @SuppressWarnings("unchecked") T getAVObject(String key); T getAVObject(String key, Class<T> clazz); @SuppressWarnings("unchecked") T getAVUser(String key); T getAVUser(String key, Class<T> clazz); AVRelation<T> getRelation(String key); String getString(String key); Date getUpdatedAt(); boolean has(String key); boolean hasSameId(AVObject other); void increment(String key); void increment(final String key, final Number amount); boolean isDataAvailable(); Set<String> keySet(); void put(final String key, final Object value); void refresh(); void refresh(String includeKeys); void refreshInBackground(RefreshCallback<AVObject> callback); void refreshInBackground(String includeKeys, RefreshCallback<AVObject> callback); void remove(String key); void removeAll(final String key, final Collection<?> values); void save(); void save(AVSaveOption option); static void saveAll(List<? extends AVObject> objects); static void saveAllInBackground(List<? extends AVObject> objects); static void saveAllInBackground(List<? extends AVObject> objects, SaveCallback callback); void saveEventually(); void saveEventually(SaveCallback callback); void saveInBackground(); void saveInBackground(AVSaveOption option); void saveInBackground(SaveCallback callback); void saveInBackground(AVSaveOption option, SaveCallback callback); void setACL(AVACL acl); void setObjectId(String newObjectId); static void saveFileBeforeSave(List<AVFile> files, final boolean sync,
final SaveCallback callback); @Override int hashCode(); @Override boolean equals(Object obj); @Override int describeContents(); @Override void writeToParcel(Parcel out, int i); static final String CREATED_AT; static final String UPDATED_AT; static final String OBJECT_ID; static final Set<String> INVALID_KEYS; static transient final Creator CREATOR; } |
@Test public void testAVFile() { AVFile file = new AVFile(); Assert.assertNotNull(file); } | public AVFile() { super(); if (PaasClient.storageInstance().getDefaultACL() != null) { acl = new AVACL(PaasClient.storageInstance().getDefaultACL()); } } | AVFile { public AVFile() { super(); if (PaasClient.storageInstance().getDefaultACL() != null) { acl = new AVACL(PaasClient.storageInstance().getDefaultACL()); } } } | AVFile { public AVFile() { super(); if (PaasClient.storageInstance().getDefaultACL() != null) { acl = new AVACL(PaasClient.storageInstance().getDefaultACL()); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public AVFile() { super(); if (PaasClient.storageInstance().getDefaultACL() != null) { acl = new AVACL(PaasClient.storageInstance().getDefaultACL()); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public AVFile() { super(); if (PaasClient.storageInstance().getDefaultACL() != null) { acl = new AVACL(PaasClient.storageInstance().getDefaultACL()); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testSetObjectId() { String objectId = "testObjectId"; AVFile file = new AVFile(); file.setObjectId(objectId); Assert.assertEquals(objectId, file.getObjectId()); } | public void setObjectId(String objectId) { this.objectId = objectId; } | AVFile { public void setObjectId(String objectId) { this.objectId = objectId; } } | AVFile { public void setObjectId(String objectId) { this.objectId = objectId; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void setObjectId(String objectId) { this.objectId = objectId; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void setObjectId(String objectId) { this.objectId = objectId; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testAddMetaData() { AVFile file = new AVFile(); file.addMetaData("key", "value"); Assert.assertEquals(file.getMetaData("key"), "value"); } | public Object addMetaData(String key, Object val) { return metaData.put(key, val); } | AVFile { public Object addMetaData(String key, Object val) { return metaData.put(key, val); } } | AVFile { public Object addMetaData(String key, Object val) { return metaData.put(key, val); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public Object addMetaData(String key, Object val) { return metaData.put(key, val); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public Object addMetaData(String key, Object val) { return metaData.put(key, val); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetMetaData() { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); Assert.assertNotNull(file.getMetaData()); } | public HashMap<String, Object> getMetaData() { return metaData; } | AVFile { public HashMap<String, Object> getMetaData() { return metaData; } } | AVFile { public HashMap<String, Object> getMetaData() { return metaData; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public HashMap<String, Object> getMetaData() { return metaData; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public HashMap<String, Object> getMetaData() { return metaData; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetSize() { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); Assert.assertEquals(file.getSize(), TEST_FILE_CONTENT.length()); } | public int getSize() { Number size = (Number) getMetaData("size"); if (size != null) return size.intValue(); else return -1; } | AVFile { public int getSize() { Number size = (Number) getMetaData("size"); if (size != null) return size.intValue(); else return -1; } } | AVFile { public int getSize() { Number size = (Number) getMetaData("size"); if (size != null) return size.intValue(); else return -1; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public int getSize() { Number size = (Number) getMetaData("size"); if (size != null) return size.intValue(); else return -1; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public int getSize() { Number size = (Number) getMetaData("size"); if (size != null) return size.intValue(); else return -1; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testZeroAdapterSize(){ Assert.assertTrue(mAdapter.isEmpty()); } | public boolean isEmpty() { return mSnackbarViews == null || mSnackbarViews.size() == 0; } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public boolean isEmpty() { return mSnackbarViews == null || mSnackbarViews.size() == 0; } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public boolean isEmpty() { return mSnackbarViews == null || mSnackbarViews.size() == 0; } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public boolean isEmpty() { return mSnackbarViews == null || mSnackbarViews.size() == 0; } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public boolean isEmpty() { return mSnackbarViews == null || mSnackbarViews.size() == 0; } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } |
@Test public void testOnCreateViewHolder() throws Exception { mAdapter.addItem(viewMock); PowerMockito.whenNew(SnackbarAdapter.ViewHolder.class).withAnyArguments().thenReturn(mViewHolder); mAdapter.onCreateViewHolder(null, 0); Mockito.verify(viewMock, Mockito.times(1)).onCreateView(null); } | @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int position) { View view = mSnackbarViews.get(position).onCreateView(parent); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int position) { View view = mSnackbarViews.get(position).onCreateView(parent); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int position) { View view = mSnackbarViews.get(position).onCreateView(parent); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int position) { View view = mSnackbarViews.get(position).onCreateView(parent); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int position) { View view = mSnackbarViews.get(position).onCreateView(parent); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } |
@Test public void testOnBindViewHolder() throws Exception{ mAdapter.addItem(viewMock); PowerMockito.whenNew(SnackbarAdapter.ViewHolder.class).withAnyArguments().thenReturn(mViewHolder); mAdapter.onCreateViewHolder(null, 0); mAdapter.onBindViewHolder(mViewHolder,0); Mockito.verify(viewMock, Mockito.times(1)).onBindView(); } | @Override public void onBindViewHolder(ViewHolder holder, int position) { SnackbarView snackbarView = mSnackbarViews.get(position); if (snackbarView != null) { snackbarView.onBindView(); } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public void onBindViewHolder(ViewHolder holder, int position) { SnackbarView snackbarView = mSnackbarViews.get(position); if (snackbarView != null) { snackbarView.onBindView(); } } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public void onBindViewHolder(ViewHolder holder, int position) { SnackbarView snackbarView = mSnackbarViews.get(position); if (snackbarView != null) { snackbarView.onBindView(); } } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public void onBindViewHolder(ViewHolder holder, int position) { SnackbarView snackbarView = mSnackbarViews.get(position); if (snackbarView != null) { snackbarView.onBindView(); } } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { @Override public void onBindViewHolder(ViewHolder holder, int position) { SnackbarView snackbarView = mSnackbarViews.get(position); if (snackbarView != null) { snackbarView.onBindView(); } } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } |
@Test public void testAddItem(){ mAdapter.addItem(viewMock); Assert.assertEquals(mAdapter.getItemCount(),1); } | public synchronized void addItem(SnackbarView item) { mSnackbarViews.add(item); int position = mSnackbarViews.indexOf(item); notifyItemInserted(position); } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void addItem(SnackbarView item) { mSnackbarViews.add(item); int position = mSnackbarViews.indexOf(item); notifyItemInserted(position); } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void addItem(SnackbarView item) { mSnackbarViews.add(item); int position = mSnackbarViews.indexOf(item); notifyItemInserted(position); } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void addItem(SnackbarView item) { mSnackbarViews.add(item); int position = mSnackbarViews.indexOf(item); notifyItemInserted(position); } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void addItem(SnackbarView item) { mSnackbarViews.add(item); int position = mSnackbarViews.indexOf(item); notifyItemInserted(position); } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } |
@Test public void testRemoveItem(){ mAdapter.addItem(viewMock); Assert.assertEquals(mAdapter.getItemCount(),1); mAdapter.removeItem(viewMock); Assert.assertEquals(mAdapter.getItemCount(),0); } | public synchronized void removeItem(SnackbarView view) { int position = mSnackbarViews.indexOf(view); if (position > -1) { mSnackbarViews.remove(position); notifyItemRemoved(position); } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void removeItem(SnackbarView view) { int position = mSnackbarViews.indexOf(view); if (position > -1) { mSnackbarViews.remove(position); notifyItemRemoved(position); } } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void removeItem(SnackbarView view) { int position = mSnackbarViews.indexOf(view); if (position > -1) { mSnackbarViews.remove(position); notifyItemRemoved(position); } } } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void removeItem(SnackbarView view) { int position = mSnackbarViews.indexOf(view); if (position > -1) { mSnackbarViews.remove(position); notifyItemRemoved(position); } } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } | SnackbarAdapter extends RecyclerView.Adapter<SnackbarAdapter.ViewHolder> { public synchronized void removeItem(SnackbarView view) { int position = mSnackbarViews.indexOf(view); if (position > -1) { mSnackbarViews.remove(position); notifyItemRemoved(position); } } @Override ViewHolder onCreateViewHolder(ViewGroup parent, int position); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); boolean isEmpty(); synchronized void addItem(SnackbarView item); synchronized void removeItem(SnackbarView view); SnackbarView getSnackbarView(int index); } |
@Test public void testEqualsNotEqualToNull() { Object rhs = null; NumberInterval instance = new NumberInterval(); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidateLowAndHighEqual() throws Exception { NumberInterval instance = new NumberInterval( new NumberIntervalBoundary(10.0, true), new NumberIntervalBoundary(10.0, true) ); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidateInfinity() throws Exception { NumberInterval instance = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, NumberIntervalBoundary.POSITIVE_INFINITY ); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidateLowInfinity() throws Exception { NumberInterval instance = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, new NumberIntervalBoundary(10.0, true) ); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidateHighInfinity() throws Exception { NumberInterval instance = new NumberInterval( new NumberIntervalBoundary(10.0, true), NumberIntervalBoundary.POSITIVE_INFINITY ); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidate() throws Exception { NumberInterval instance = new NumberInterval( new NumberIntervalBoundary(-10.0), new NumberIntervalBoundary(10.0, false) ); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testOverlaps() { NumberInterval lhs; NumberInterval rhs; lhs = new NumberInterval( new NumberIntervalBoundary(-10.0), new NumberIntervalBoundary(10.0) ); testOverlapCommon(lhs); rhs = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, new NumberIntervalBoundary(-10.0, true) ); assertDontOverlap(lhs, rhs); rhs = new NumberInterval( new NumberIntervalBoundary(10.0, true), NumberIntervalBoundary.POSITIVE_INFINITY ); assertDontOverlap(lhs, rhs); lhs = new NumberInterval( new NumberIntervalBoundary(-10.0, true), new NumberIntervalBoundary(10.0) ); testOverlapCommon(lhs); rhs = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, new NumberIntervalBoundary(-10.0, true) ); assertOverlap(lhs, rhs); rhs = new NumberInterval( new NumberIntervalBoundary(10.0, true), NumberIntervalBoundary.POSITIVE_INFINITY ); assertDontOverlap(lhs, rhs); lhs = new NumberInterval( new NumberIntervalBoundary(-10.0), new NumberIntervalBoundary(10.0, true) ); testOverlapCommon(lhs); rhs = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, new NumberIntervalBoundary(-10.0, true) ); assertDontOverlap(lhs, rhs); rhs = new NumberInterval( new NumberIntervalBoundary(10.0, true), NumberIntervalBoundary.POSITIVE_INFINITY ); assertOverlap(lhs, rhs); lhs = new NumberInterval( new NumberIntervalBoundary(-10.0, true), new NumberIntervalBoundary(10.0, true) ); testOverlapCommon(lhs); rhs = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, new NumberIntervalBoundary(-10.0, true) ); assertOverlap(lhs, rhs); rhs = new NumberInterval( new NumberIntervalBoundary(10.0, true), NumberIntervalBoundary.POSITIVE_INFINITY ); assertOverlap(lhs, rhs); } | public boolean overlaps(NumberInterval rhs) { return !doesNotOverlap(rhs); } | NumberInterval { public boolean overlaps(NumberInterval rhs) { return !doesNotOverlap(rhs); } } | NumberInterval { public boolean overlaps(NumberInterval rhs) { return !doesNotOverlap(rhs); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public boolean overlaps(NumberInterval rhs) { return !doesNotOverlap(rhs); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public boolean overlaps(NumberInterval rhs) { return !doesNotOverlap(rhs); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidateNoIntervals() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test public void testValidateEmptyIntervals() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList()); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test(expected = BadValueException.class) public void testValidateBadInterval() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList( new NumberInterval() )); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test public void testValidateSingle() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList( new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, NumberIntervalBoundary.POSITIVE_INFINITY ) )); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test public void testEqualsNotEqualToOtherClasses() { Object rhs = new Object(); NumberInterval instance = new NumberInterval(); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test(expected = BadValueException.class) public void testValidateOverlap() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList( new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, NumberIntervalBoundary.POSITIVE_INFINITY ), new NumberInterval( new NumberIntervalBoundary(10.0, true), new NumberIntervalBoundary(10.0, true) ) )); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test(expected = BadValueException.class) public void testValidateOverlapSwapped() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList( new NumberInterval( new NumberIntervalBoundary(10.0, true), new NumberIntervalBoundary(10.0, true) ), new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, NumberIntervalBoundary.POSITIVE_INFINITY ) )); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test public void testValidateTwo() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList( new NumberInterval( new NumberIntervalBoundary(10.0, true), new NumberIntervalBoundary(10.0, true) ), new NumberInterval( new NumberIntervalBoundary(10.0, false), new NumberIntervalBoundary(20.0, true) ) )); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test public void testValidateTwoSwapped() throws Exception { NumberAttributeDomainDto instance = new NumberAttributeDomainDto(Arrays.asList( new NumberInterval( new NumberIntervalBoundary(10.0, false), new NumberIntervalBoundary(20.0, true) ), new NumberInterval( new NumberIntervalBoundary(10.0, true), new NumberIntervalBoundary(10.0, true) ) )); instance.validate(); } | @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } | NumberAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (intervals == null) { return; } for (NumberInterval interval : intervals) { interval.validate(); } int size = intervals.size(); int count = 0; for (NumberInterval interval : intervals) { validateNoOverlap(interval, intervals.subList(++count, size)); } } NumberAttributeDomainDto(); NumberAttributeDomainDto(List<NumberInterval> intervals); @Override boolean equals(Object obj); @Override int hashCode(); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); List<NumberInterval> getIntervals(); void setIntervals(List<NumberInterval> intervals); } |
@Test public void testValidateNoRegex() throws BadValueException { StringAttributeDomainDto instance = new StringAttributeDomainDto(); instance.validate(); } | @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } |
@Test public void testValidateEmptyRegex() throws BadValueException { StringAttributeDomainDto instance = new StringAttributeDomainDto(""); instance.validate(); } | @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } |
@Test(expected = PatternSyntaxException.class) public void testValidateBadRegex() throws BadValueException, Throwable { StringAttributeDomainDto instance = new StringAttributeDomainDto("["); try { instance.validate(); } catch (BadValueException ex) { if (ex.getCause() instanceof PatternSyntaxException) { throw ex.getCause(); } throw ex; } } | @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } |
@Test public void testValidateRegex() throws BadValueException { StringAttributeDomainDto instance = new StringAttributeDomainDto("prefix-[0-9]+"); instance.validate(); } | @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } | StringAttributeDomainDto extends AttributeDomainDto { @Override public void validate() throws BadValueException { if (regex == null) { return; } try { Pattern.compile(regex); } catch (PatternSyntaxException ex) { throw new BadValueException("Invalid regex: " + ex.getMessage(), ex); } } StringAttributeDomainDto(); StringAttributeDomainDto(String regex); @Override AttributeType getType(); @Override void accept(AttributeDomainDtoVisitor visitor); @Override void validate(); String getRegex(); void setRegex(String regex); } |
@Test public void testNotEqualToNull() { Object rhs = null; NumberIntervalBoundary instance = new NumberIntervalBoundary(); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testNotEqualToOtherClasses() { Object rhs = new Object(); NumberIntervalBoundary instance = new NumberIntervalBoundary(); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testEquals() { NumberInterval rhs = new NumberInterval(); rhs.setLow(new NumberIntervalBoundary(0.0)); rhs.setHigh(new NumberIntervalBoundary(10.0)); NumberInterval instance = new NumberInterval(); instance.setLow(new NumberIntervalBoundary(0.0)); instance.setHigh(new NumberIntervalBoundary(10.0)); assertTrue(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberInterval)) { return false; } NumberInterval rhs = (NumberInterval) obj; return Objects.equals(low, rhs.low) && Objects.equals(high, rhs.high); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testNotEqualToDifferentBoundarySameInclusion() { NumberIntervalBoundary rhs = new NumberIntervalBoundary(10.0); NumberIntervalBoundary instance = new NumberIntervalBoundary(11.0); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testNotEqualToSameBoundaryDifferentInclusion() { NumberIntervalBoundary rhs = new NumberIntervalBoundary(10.0, true); NumberIntervalBoundary instance = new NumberIntervalBoundary(10.0, false); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testNotEqualToDifferentBoundaryDifferentInclusion() { NumberIntervalBoundary rhs = new NumberIntervalBoundary(10.0, true); NumberIntervalBoundary instance = new NumberIntervalBoundary(12.0, null); assertFalse(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testEquals() { NumberIntervalBoundary rhs = new NumberIntervalBoundary(10.0, true); NumberIntervalBoundary instance = new NumberIntervalBoundary(10.0, true); assertTrue(instance.equals(rhs)); } | @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public boolean equals(Object obj) { if (!(obj instanceof NumberIntervalBoundary)) { return false; } NumberIntervalBoundary rhs = (NumberIntervalBoundary) obj; return Objects.equals(boundary, rhs.boundary) && (isInclusive() == rhs.isInclusive()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testHashCodeForEqualInstances() { int lhs = new NumberIntervalBoundary(1.1, Boolean.FALSE).hashCode(); int rhs = new NumberIntervalBoundary(1.1, Boolean.FALSE).hashCode(); assertEquals(lhs, rhs); } | @Override public int hashCode() { return Objects.hash(this.boundary, isInclusive() ? Boolean.TRUE : Boolean.FALSE); } | NumberIntervalBoundary { @Override public int hashCode() { return Objects.hash(this.boundary, isInclusive() ? Boolean.TRUE : Boolean.FALSE); } } | NumberIntervalBoundary { @Override public int hashCode() { return Objects.hash(this.boundary, isInclusive() ? Boolean.TRUE : Boolean.FALSE); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @Override public int hashCode() { return Objects.hash(this.boundary, isInclusive() ? Boolean.TRUE : Boolean.FALSE); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @Override public int hashCode() { return Objects.hash(this.boundary, isInclusive() ? Boolean.TRUE : Boolean.FALSE); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testNotIsInclusiveByDefault() { NumberIntervalBoundary instance = new NumberIntervalBoundary(); assertFalse(instance.isInclusive()); } | @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testNotIsInclusiveWhenConstructedWithFalse() { NumberIntervalBoundary instance = new NumberIntervalBoundary(0.0, false); assertFalse(instance.isInclusive()); } | @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testNotIsInclusiveWhenConstructedWithNull() { NumberIntervalBoundary instance = new NumberIntervalBoundary(0.0, null); assertFalse(instance.isInclusive()); } | @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testIsInclusiveWhenConstructedWithTrue() { NumberIntervalBoundary instance = new NumberIntervalBoundary(0.0, true); assertTrue(instance.isInclusive()); } | @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { @JsonIgnore public boolean isInclusive() { return inclusive != null && inclusive; } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testCompareBoundaryTo() { NumberIntervalBoundary instance = new NumberIntervalBoundary(0.0); assertThat(instance.compareBoundaryTo(new NumberIntervalBoundary(0.0)), comparesEqualTo(0)); assertThat(instance.compareBoundaryTo(new NumberIntervalBoundary(-5.0)), greaterThan(0)); assertThat(instance.compareBoundaryTo(NumberIntervalBoundary.NEGATIVE_INFINITY), greaterThan(0)); assertThat(instance.compareBoundaryTo(new NumberIntervalBoundary(5.0)), lessThan(0)); assertThat(instance.compareBoundaryTo(NumberIntervalBoundary.POSITIVE_INFINITY), lessThan(0)); } | public int compareBoundaryTo(NumberIntervalBoundary rhs) { return boundary.compareTo(rhs.getBoundary()); } | NumberIntervalBoundary { public int compareBoundaryTo(NumberIntervalBoundary rhs) { return boundary.compareTo(rhs.getBoundary()); } } | NumberIntervalBoundary { public int compareBoundaryTo(NumberIntervalBoundary rhs) { return boundary.compareTo(rhs.getBoundary()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { public int compareBoundaryTo(NumberIntervalBoundary rhs) { return boundary.compareTo(rhs.getBoundary()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { public int compareBoundaryTo(NumberIntervalBoundary rhs) { return boundary.compareTo(rhs.getBoundary()); } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testToString() { NumberInterval instance; instance = new NumberInterval(); assertEquals("null, null", instance.toString()); instance = new NumberInterval( NumberIntervalBoundary.NEGATIVE_INFINITY, NumberIntervalBoundary.POSITIVE_INFINITY); assertEquals("(-Infinity, Infinity)", instance.toString()); instance = new NumberInterval( new NumberIntervalBoundary(0.0, true), new NumberIntervalBoundary(10.3, false)); assertEquals("[0.0, 10.3)", instance.toString()); instance = new NumberInterval( new NumberIntervalBoundary(0.0, null), new NumberIntervalBoundary(10.3, true)); assertEquals("(0.0, 10.3]", instance.toString()); } | @Override public String toString() { return lowToString() + ", " + highToString(); } | NumberInterval { @Override public String toString() { return lowToString() + ", " + highToString(); } } | NumberInterval { @Override public String toString() { return lowToString() + ", " + highToString(); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { @Override public String toString() { return lowToString() + ", " + highToString(); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { @Override public String toString() { return lowToString() + ", " + highToString(); } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void testValidateValid() throws Exception { NumberIntervalBoundary instance = new NumberIntervalBoundary(0.0); instance.validate(); } | public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test(expected = BadValueException.class) public void testValidateInvalid() throws Exception { NumberIntervalBoundary instance = new NumberIntervalBoundary(); instance.validate(); } | public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); } | NumberIntervalBoundary { public void validate() throws BadValueException { if (boundary == null) { throw new BadValueException("NumberIntervalBoundary.boundary is required"); } } NumberIntervalBoundary(); NumberIntervalBoundary(Double boundary); NumberIntervalBoundary(Double boundary, Boolean inclusive); @Override boolean equals(Object obj); @Override int hashCode(); int compareBoundaryTo(NumberIntervalBoundary rhs); void validate(); Double getBoundary(); void setBoundary(Double boundary); @JsonIgnore boolean isInclusive(); Boolean getInclusive(); void setInclusive(Boolean inclusive); static NumberIntervalBoundary POSITIVE_INFINITY; static NumberIntervalBoundary NEGATIVE_INFINITY; } |
@Test public void testCleanShutdown() throws InterruptedException { final int wait = 1; ExecutorService threadPool = mock(ExecutorService.class); when(threadPool.awaitTermination(wait, TimeUnit.SECONDS)).thenReturn(true); ThreadPoolKiller.shutdown(threadPool, "TestPool", wait); verify(threadPool).shutdown(); verify(threadPool).awaitTermination(wait, TimeUnit.SECONDS); } | public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); static final long DEFAULT_WAIT_DOWN_SECONDS; } |
@Test public void testForcedShutdown() throws InterruptedException { final int wait = 1; ExecutorService threadPool = mock(ExecutorService.class); when(threadPool.awaitTermination(wait, TimeUnit.SECONDS)).thenReturn(false).thenReturn(true); ThreadPoolKiller.shutdown(threadPool, "TestPool", wait); verify(threadPool).shutdown(); verify(threadPool, times(2)).awaitTermination(wait, TimeUnit.SECONDS); verify(threadPool).shutdownNow(); verifyNoMoreInteractions(threadPool); } | public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); static final long DEFAULT_WAIT_DOWN_SECONDS; } |
@Test public void testForcedShutdownTimesOut() throws InterruptedException { final int wait = 1; ExecutorService threadPool = mock(ExecutorService.class); when(threadPool.awaitTermination(wait, TimeUnit.SECONDS)).thenReturn(false).thenReturn(false); ThreadPoolKiller.shutdown(threadPool, "TestPool", wait); verify(threadPool).shutdown(); verify(threadPool, times(2)).awaitTermination(wait, TimeUnit.SECONDS); verify(threadPool).shutdownNow(); verifyNoMoreInteractions(threadPool); } | public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); static final long DEFAULT_WAIT_DOWN_SECONDS; } |
@Test public void testShutdownInterrupted() throws InterruptedException { final int wait = 1; ExecutorService threadPool = mock(ExecutorService.class); when(threadPool.awaitTermination(wait, TimeUnit.SECONDS)).thenThrow(InterruptedException.class); ThreadPoolKiller.shutdown(threadPool, "TestPool", wait); verify(threadPool).shutdown(); verify(threadPool).awaitTermination(wait, TimeUnit.SECONDS); verifyNoMoreInteractions(threadPool); } | public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); static final long DEFAULT_WAIT_DOWN_SECONDS; } |
@Test public void testShutdownDefaultTimeout() throws InterruptedException { final long wait = ThreadPoolKiller.DEFAULT_WAIT_DOWN_SECONDS; ExecutorService threadPool = mock(ExecutorService.class); when(threadPool.awaitTermination(wait, TimeUnit.SECONDS)).thenReturn(true); ThreadPoolKiller.shutdown(threadPool, "TestPool"); verify(threadPool).shutdown(); verify(threadPool).awaitTermination(wait, TimeUnit.SECONDS); verifyNoMoreInteractions(threadPool); } | public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); } | ThreadPoolKiller { public static void shutdown(ExecutorService threadPool, String name) { shutdown(threadPool, name, DEFAULT_WAIT_DOWN_SECONDS); } static void shutdown(ExecutorService threadPool, String name); static void shutdown(ExecutorService threadPool, String name, long waitSeconds); static final long DEFAULT_WAIT_DOWN_SECONDS; } |
@Test public void create() throws Exception { String agentRef = UUID.randomUUID().toString(); stubFor(post(urlEqualTo("/api/routers/" + routerRef + "/agents")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(201) .withHeader("Content-Type", "application/json") .withBody("{\"ref\":\"" + agentRef + "\"}"))); CreateAgentArg createArg = new CreateAgentArg(); createArg.setAddress("sip:[email protected]"); ApiObjectRef apiObjectId = serviceClient.create(createArg, routerRef); LOGGER.debug("apiObjectId: {}", apiObjectId); assertEquals("agentRef", agentRef, apiObjectId.getRef()); } | @Override public ApiObjectRef create(CreateAgentArg createArg, String routerRef) throws CommsRouterException { return post(createArg, routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef create(CreateAgentArg createArg, String routerRef) throws CommsRouterException { return post(createArg, routerRef); } } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef create(CreateAgentArg createArg, String routerRef) throws CommsRouterException { return post(createArg, routerRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef create(CreateAgentArg createArg, String routerRef) throws CommsRouterException { return post(createArg, routerRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef create(CreateAgentArg createArg, String routerRef) throws CommsRouterException { return post(createArg, routerRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } |
@Test public void createWithId() throws Exception { String agentRef = UUID.randomUUID().toString(); stubFor(put(urlEqualTo("/api/routers/" + routerRef + "/agents/" + agentRef)) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(201) .withHeader("Content-Type", "application/json") .withBody("{\"ref\":\"" + agentRef + "\"}"))); CreateAgentArg createArg = new CreateAgentArg(); createArg.setAddress("sip:[email protected]"); ApiObjectRef apiObjectRef = serviceClient.replace(createArg, new RouterObjectRef(agentRef, routerRef)); LOGGER.debug("apiObjectId: {}", apiObjectRef); assertEquals("agentRef", agentRef, apiObjectRef.getRef()); } | @Override public ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef) throws CommsRouterException { return put(createArg, objectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef) throws CommsRouterException { return put(createArg, objectRef); } } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef) throws CommsRouterException { return put(createArg, objectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef) throws CommsRouterException { return put(createArg, objectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef) throws CommsRouterException { return put(createArg, objectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } |
@Test public void update() throws Exception { String agentId = UUID.randomUUID().toString(); stubFor(put(urlEqualTo("/api/routers/" + routerRef + "/agents/" + agentId)) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(204) .withHeader("Content-Type", "application/json"))); UpdateAgentArg updateAgentArg = new UpdateAgentArg(); updateAgentArg.setAddress("sip:[email protected]"); serviceClient.update(updateAgentArg, new RouterObjectRef(agentId, routerRef)); } | @Override public void update(UpdateAgentArg updateArg, RouterObjectRef objectRef) throws CommsRouterException { post(updateArg, objectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void update(UpdateAgentArg updateArg, RouterObjectRef objectRef) throws CommsRouterException { post(updateArg, objectRef); } } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void update(UpdateAgentArg updateArg, RouterObjectRef objectRef) throws CommsRouterException { post(updateArg, objectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void update(UpdateAgentArg updateArg, RouterObjectRef objectRef) throws CommsRouterException { post(updateArg, objectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void update(UpdateAgentArg updateArg, RouterObjectRef objectRef) throws CommsRouterException { post(updateArg, objectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } |
@Test(expected = BadValueException.class) public void testValidateNoBoundaries() throws Exception { NumberInterval instance = new NumberInterval(); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void get() throws Exception { String agentId = UUID.randomUUID().toString(); AgentDto agent = new AgentDto(); agent.setAddress("sip:[email protected]"); stubFor(WireMock.get(urlEqualTo("/api/routers/" + routerRef + "/agents/" + agentId)) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(objectMapper.writeValueAsString(agent)))); AgentDto agentDto = serviceClient.get(new RouterObjectRef(agentId, routerRef)); assertNotNull("agent is found", agentDto); assertEquals("address matches", agent.getAddress(), agentDto.getAddress()); } | @Override public AgentDto get(RouterObjectRef routerObjectRef) throws CommsRouterException { return getItem(routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public AgentDto get(RouterObjectRef routerObjectRef) throws CommsRouterException { return getItem(routerObjectRef); } } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public AgentDto get(RouterObjectRef routerObjectRef) throws CommsRouterException { return getItem(routerObjectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public AgentDto get(RouterObjectRef routerObjectRef) throws CommsRouterException { return getItem(routerObjectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public AgentDto get(RouterObjectRef routerObjectRef) throws CommsRouterException { return getItem(routerObjectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } |
@Test public void list() throws Exception { } | @Override public PaginatedList<AgentDto> list(PagingRequest request) throws CommsRouterException { PagingRequest pagingRequest = new PagingRequest( routerRef, request.getToken(), request.getPerPage(), request.getSort(), request.getQuery()); return getList(pagingRequest, new GenericType<List<AgentDto>>() {}); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public PaginatedList<AgentDto> list(PagingRequest request) throws CommsRouterException { PagingRequest pagingRequest = new PagingRequest( routerRef, request.getToken(), request.getPerPage(), request.getSort(), request.getQuery()); return getList(pagingRequest, new GenericType<List<AgentDto>>() {}); } } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public PaginatedList<AgentDto> list(PagingRequest request) throws CommsRouterException { PagingRequest pagingRequest = new PagingRequest( routerRef, request.getToken(), request.getPerPage(), request.getSort(), request.getQuery()); return getList(pagingRequest, new GenericType<List<AgentDto>>() {}); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public PaginatedList<AgentDto> list(PagingRequest request) throws CommsRouterException { PagingRequest pagingRequest = new PagingRequest( routerRef, request.getToken(), request.getPerPage(), request.getSort(), request.getQuery()); return getList(pagingRequest, new GenericType<List<AgentDto>>() {}); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public PaginatedList<AgentDto> list(PagingRequest request) throws CommsRouterException { PagingRequest pagingRequest = new PagingRequest( routerRef, request.getToken(), request.getPerPage(), request.getSort(), request.getQuery()); return getList(pagingRequest, new GenericType<List<AgentDto>>() {}); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } |
@Test public void delete() throws Exception { String agentRef = UUID.randomUUID().toString(); stubFor(WireMock.delete(urlEqualTo("/api/routers/" + routerRef + "/agents/" + agentRef)) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(204) .withHeader("Content-Type", "application/json"))); serviceClient.delete(new RouterObjectRef(agentRef, routerRef)); } | @Override public void delete(RouterObjectRef routerObjectRef) { routerObjectRef.setRouterRef(routerRef); deleteRequest(routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void delete(RouterObjectRef routerObjectRef) { routerObjectRef.setRouterRef(routerRef); deleteRequest(routerObjectRef); } } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void delete(RouterObjectRef routerObjectRef) { routerObjectRef.setRouterRef(routerRef); deleteRequest(routerObjectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void delete(RouterObjectRef routerObjectRef) { routerObjectRef.setRouterRef(routerRef); deleteRequest(routerObjectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } | AgentServiceClient extends ServiceClientBase<AgentDto, ApiObjectRef> implements AgentService { @Override public void delete(RouterObjectRef routerObjectRef) { routerObjectRef.setRouterRef(routerRef); deleteRequest(routerObjectRef); } @Inject AgentServiceClient(Client client, String endpoint, String routerRef); @Override ApiObjectRef create(CreateAgentArg createArg, String routerRef); @Override ApiObjectRef replace(CreateAgentArg createArg, RouterObjectRef objectRef); @Override void update(UpdateAgentArg updateArg, RouterObjectRef objectRef); @Override AgentDto get(RouterObjectRef routerObjectRef); @Override PaginatedList<AgentDto> list(PagingRequest request); @Override void delete(RouterObjectRef routerObjectRef); } |
@Test public void getJwtAuthMethod() throws Exception { assertNotNull("JWT is not null", configuration.getJwtAuthMethod()); } | @Override public JWTAuthMethod getJwtAuthMethod() { return jwtAuthMethod; } | ConfigurationImpl implements Configuration { @Override public JWTAuthMethod getJwtAuthMethod() { return jwtAuthMethod; } } | ConfigurationImpl implements Configuration { @Override public JWTAuthMethod getJwtAuthMethod() { return jwtAuthMethod; } @Inject ConfigurationImpl(ConfigurationProperties properties); } | ConfigurationImpl implements Configuration { @Override public JWTAuthMethod getJwtAuthMethod() { return jwtAuthMethod; } @Inject ConfigurationImpl(ConfigurationProperties properties); @Override JWTAuthMethod getJwtAuthMethod(); @Override Endpoint getAssociatedPhone(); @Override String getCallbackBaseUrl(); @Override String getNexmoCallbackBaseUrl(); @Override String getCommsApiEndpoint(); @Override String getCommsRouterId(); @Override String getMusicOnHoldUrl(); @Override String getCommsQueueId(); @Override String getCommsPlanId(); } | ConfigurationImpl implements Configuration { @Override public JWTAuthMethod getJwtAuthMethod() { return jwtAuthMethod; } @Inject ConfigurationImpl(ConfigurationProperties properties); @Override JWTAuthMethod getJwtAuthMethod(); @Override Endpoint getAssociatedPhone(); @Override String getCallbackBaseUrl(); @Override String getNexmoCallbackBaseUrl(); @Override String getCommsApiEndpoint(); @Override String getCommsRouterId(); @Override String getMusicOnHoldUrl(); @Override String getCommsQueueId(); @Override String getCommsPlanId(); } |
@Test public void getAssociatedPhone() throws Exception { assertEquals("Phone equals", "17072158889", configuration.getAssociatedPhone().toLog()); } | @Override public Endpoint getAssociatedPhone() { return phoneEndpoint; } | ConfigurationImpl implements Configuration { @Override public Endpoint getAssociatedPhone() { return phoneEndpoint; } } | ConfigurationImpl implements Configuration { @Override public Endpoint getAssociatedPhone() { return phoneEndpoint; } @Inject ConfigurationImpl(ConfigurationProperties properties); } | ConfigurationImpl implements Configuration { @Override public Endpoint getAssociatedPhone() { return phoneEndpoint; } @Inject ConfigurationImpl(ConfigurationProperties properties); @Override JWTAuthMethod getJwtAuthMethod(); @Override Endpoint getAssociatedPhone(); @Override String getCallbackBaseUrl(); @Override String getNexmoCallbackBaseUrl(); @Override String getCommsApiEndpoint(); @Override String getCommsRouterId(); @Override String getMusicOnHoldUrl(); @Override String getCommsQueueId(); @Override String getCommsPlanId(); } | ConfigurationImpl implements Configuration { @Override public Endpoint getAssociatedPhone() { return phoneEndpoint; } @Inject ConfigurationImpl(ConfigurationProperties properties); @Override JWTAuthMethod getJwtAuthMethod(); @Override Endpoint getAssociatedPhone(); @Override String getCallbackBaseUrl(); @Override String getNexmoCallbackBaseUrl(); @Override String getCommsApiEndpoint(); @Override String getCommsRouterId(); @Override String getMusicOnHoldUrl(); @Override String getCommsQueueId(); @Override String getCommsPlanId(); } |
@Test public void getCallbackBaseUrl() throws Exception { assertEquals("Url equals", "https: } | @Override public String getCallbackBaseUrl() { return callbackBaseUrl; } | ConfigurationImpl implements Configuration { @Override public String getCallbackBaseUrl() { return callbackBaseUrl; } } | ConfigurationImpl implements Configuration { @Override public String getCallbackBaseUrl() { return callbackBaseUrl; } @Inject ConfigurationImpl(ConfigurationProperties properties); } | ConfigurationImpl implements Configuration { @Override public String getCallbackBaseUrl() { return callbackBaseUrl; } @Inject ConfigurationImpl(ConfigurationProperties properties); @Override JWTAuthMethod getJwtAuthMethod(); @Override Endpoint getAssociatedPhone(); @Override String getCallbackBaseUrl(); @Override String getNexmoCallbackBaseUrl(); @Override String getCommsApiEndpoint(); @Override String getCommsRouterId(); @Override String getMusicOnHoldUrl(); @Override String getCommsQueueId(); @Override String getCommsPlanId(); } | ConfigurationImpl implements Configuration { @Override public String getCallbackBaseUrl() { return callbackBaseUrl; } @Inject ConfigurationImpl(ConfigurationProperties properties); @Override JWTAuthMethod getJwtAuthMethod(); @Override Endpoint getAssociatedPhone(); @Override String getCallbackBaseUrl(); @Override String getNexmoCallbackBaseUrl(); @Override String getCommsApiEndpoint(); @Override String getCommsRouterId(); @Override String getMusicOnHoldUrl(); @Override String getCommsQueueId(); @Override String getCommsPlanId(); } |
@Test public void getCallbackBaseUrl() throws Exception { assertEquals("Url equals", "https: } | @Override public String callbackBaseUrl() { return provider.getProperty("app.callbackBaseUrl", String.class); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return provider.getProperty("app.callbackBaseUrl", String.class); } } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return provider.getProperty("app.callbackBaseUrl", String.class); } Cfg4jConfiguration(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return provider.getProperty("app.callbackBaseUrl", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return provider.getProperty("app.callbackBaseUrl", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void getPhone() throws Exception { assertEquals("Phone equals", "17072158889", configuration.phone()); } | @Override public String phone() { return provider.getProperty("app.phone", String.class); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String phone() { return provider.getProperty("app.phone", String.class); } } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String phone() { return provider.getProperty("app.phone", String.class); } Cfg4jConfiguration(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String phone() { return provider.getProperty("app.phone", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String phone() { return provider.getProperty("app.phone", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void getAppId() throws Exception { assertEquals("App Id equals", "some-app-id", configuration.appId()); } | @Override public String appId() { return provider.getProperty("nexmo.appId", String.class); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appId() { return provider.getProperty("nexmo.appId", String.class); } } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appId() { return provider.getProperty("nexmo.appId", String.class); } Cfg4jConfiguration(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appId() { return provider.getProperty("nexmo.appId", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appId() { return provider.getProperty("nexmo.appId", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void getPrivateKey() throws Exception { assertNotNull("JWT is not null", configuration.appPrivateKey()); } | @Override public String appPrivateKey() { return provider.getProperty("nexmo.appPrivateKey", String.class); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return provider.getProperty("nexmo.appPrivateKey", String.class); } } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return provider.getProperty("nexmo.appPrivateKey", String.class); } Cfg4jConfiguration(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return provider.getProperty("nexmo.appPrivateKey", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | Cfg4jConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return provider.getProperty("nexmo.appPrivateKey", String.class); } Cfg4jConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test(expected = BadValueException.class) public void testValidateNoLow() throws Exception { NumberInterval instance = new NumberInterval(null, NumberIntervalBoundary.POSITIVE_INFINITY); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test public void getCallbackBaseUrl() throws Exception { assertEquals("Url equals", "https: } | @Override public String callbackBaseUrl() { return properties.getProperty(CALLBACK_BASE_URL); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return properties.getProperty(CALLBACK_BASE_URL); } } | PropertiesConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return properties.getProperty(CALLBACK_BASE_URL); } PropertiesConfiguration(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return properties.getProperty(CALLBACK_BASE_URL); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String callbackBaseUrl() { return properties.getProperty(CALLBACK_BASE_URL); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void getPhone() throws Exception { assertEquals("Phone equals", "17072158889", configuration.phone()); } | @Override public String phone() { return properties.getProperty(APP_PHONE); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String phone() { return properties.getProperty(APP_PHONE); } } | PropertiesConfiguration implements ConfigurationProperties { @Override public String phone() { return properties.getProperty(APP_PHONE); } PropertiesConfiguration(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String phone() { return properties.getProperty(APP_PHONE); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String phone() { return properties.getProperty(APP_PHONE); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void getAppId() throws Exception { assertEquals("App Id equals", "some-app-id", configuration.appId()); } | @Override public String appId() { return properties.getProperty(NEXMO_APP_ID); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appId() { return properties.getProperty(NEXMO_APP_ID); } } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appId() { return properties.getProperty(NEXMO_APP_ID); } PropertiesConfiguration(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appId() { return properties.getProperty(NEXMO_APP_ID); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appId() { return properties.getProperty(NEXMO_APP_ID); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void getPrivateKey() throws Exception { assertNotNull("JWT is not null", configuration.appPrivateKey()); } | @Override public String appPrivateKey() { return properties.getProperty(NEXMO_APP_PRIVATE_KEY); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return properties.getProperty(NEXMO_APP_PRIVATE_KEY); } } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return properties.getProperty(NEXMO_APP_PRIVATE_KEY); } PropertiesConfiguration(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return properties.getProperty(NEXMO_APP_PRIVATE_KEY); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } | PropertiesConfiguration implements ConfigurationProperties { @Override public String appPrivateKey() { return properties.getProperty(NEXMO_APP_PRIVATE_KEY); } PropertiesConfiguration(); @Override String callbackBaseUrl(); @Override String nexmoCallbackBaseUrl(); @Override String phone(); @Override String commsRouterUrl(); @Override String commsRouterId(); @Override String appId(); @Override String appPrivateKey(); @Override String musicOnHoldUrl(); @Override String commsQueueId(); @Override String commsPlanId(); } |
@Test public void testValidate() throws Exception { System.out.println("evaluate"); CommsRouterEvaluatorFactory ef = new CommsRouterEvaluatorFactory(); try { ef.provide("HAS(#{allowedBools}, true) && IN(true, #{allowedBools}) && #{~bool}", null).validate(); assertTrue(false); } catch (ExpressionException ex) { } try { ef.provide("#{boolTrue} && #{price}>10 && #{$price}^10", null).validate(); assertTrue(false); } catch (ExpressionException ex) { } try { ef.provide("#{color}$'red'", null).validate(); assertTrue(false); } catch (ExpressionException ex) { } try { ef.provide("true", null).validate(); } catch (ExpressionException ex) { assertTrue(false); } try { ef.provide(predicateOK3, null).validate(); } catch (ExpressionException ex) { assertTrue(false); } try { ef.provide("CONTAINS([10, 20, 30], 20)", null).validate(); } catch (ExpressionException ex) { assertTrue(false); } try { ef.provide("IN('fr', ['en','fr'])", null).validate(); } catch (ExpressionException ex) { assertTrue(false); } } | @Override public void validate() throws ExpressionException { long millis = System.currentTimeMillis(); evaluator.validateImpl(); LOGGER.trace("Predicate expression validation time is: {}", (System.currentTimeMillis() - millis)); } | JEvalEvaluator implements CommsRouterEvaluator { @Override public void validate() throws ExpressionException { long millis = System.currentTimeMillis(); evaluator.validateImpl(); LOGGER.trace("Predicate expression validation time is: {}", (System.currentTimeMillis() - millis)); } } | JEvalEvaluator implements CommsRouterEvaluator { @Override public void validate() throws ExpressionException { long millis = System.currentTimeMillis(); evaluator.validateImpl(); LOGGER.trace("Predicate expression validation time is: {}", (System.currentTimeMillis() - millis)); } JEvalEvaluator(CommsRouterEvaluatorFactory factory, String predicate); } | JEvalEvaluator implements CommsRouterEvaluator { @Override public void validate() throws ExpressionException { long millis = System.currentTimeMillis(); evaluator.validateImpl(); LOGGER.trace("Predicate expression validation time is: {}", (System.currentTimeMillis() - millis)); } JEvalEvaluator(CommsRouterEvaluatorFactory factory, String predicate); @Override CommsRouterEvaluator changeExpression(String expression, String routerRef); @Override void validate(); @Override boolean evaluate(AttributeGroup attributesGroup); } | JEvalEvaluator implements CommsRouterEvaluator { @Override public void validate() throws ExpressionException { long millis = System.currentTimeMillis(); evaluator.validateImpl(); LOGGER.trace("Predicate expression validation time is: {}", (System.currentTimeMillis() - millis)); } JEvalEvaluator(CommsRouterEvaluatorFactory factory, String predicate); @Override CommsRouterEvaluator changeExpression(String expression, String routerRef); @Override void validate(); @Override boolean evaluate(AttributeGroup attributesGroup); } |
@Test(expected = ExpressionException.class) public void comparisionGtMultyArgTest() throws Exception { rsqlEvaluatorFactory.create("skill>(1,2,3)", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void comparisionGeMultyArgTest() throws Exception { rsqlEvaluatorFactory.create("skill>=(1,2,3)", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void comparisionLtMultyArgTest() throws Exception { rsqlEvaluatorFactory.create("skill<(1,2,3)", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void comparisionLeMultyArgTest() throws Exception { rsqlEvaluatorFactory.create("skill<=(1,2,3)", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void comparisionEqMultyArgTest() throws Exception { rsqlEvaluatorFactory.create("skill==(1,2,3)", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = BadValueException.class) public void testValidateNoHigh() throws Exception { NumberInterval instance = new NumberInterval(NumberIntervalBoundary.NEGATIVE_INFINITY, null); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test(expected = ExpressionException.class) public void comparisionNeMultyArgTest() throws Exception { rsqlEvaluatorFactory.create("skill!=(1,2,3)", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test public void comparisionAllSingleArgTest() throws Exception { rsqlEvaluatorFactory.create("skill>1", "routerRef"); rsqlEvaluatorFactory.create("skill>=1", "routerRef"); rsqlEvaluatorFactory.create("skill<1", "routerRef"); rsqlEvaluatorFactory.create("skill<=1", "routerRef"); rsqlEvaluatorFactory.create("skill==1", "routerRef"); rsqlEvaluatorFactory.create("skill!=1", "routerRef"); } | public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public RsqlEvaluator create(String expression, String routerRef) throws ExpressionException { try { return new RsqlEvaluator(factory, parse(expression), routerRef); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void evaluateExpressionInvalidAttributesNumber() throws Exception { String predicate = "languages=gt=en"; rsqlEvaluatorFactory.evaluate(predicate, attributeGroupe, "routerRef"); } | public boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef) throws ExpressionException { return create(expression, routerRef).evaluate(attributeGroup); } | RsqlEvaluatorFactory { public boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef) throws ExpressionException { return create(expression, routerRef).evaluate(attributeGroup); } } | RsqlEvaluatorFactory { public boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef) throws ExpressionException { return create(expression, routerRef).evaluate(attributeGroup); } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef) throws ExpressionException { return create(expression, routerRef).evaluate(attributeGroup); } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef) throws ExpressionException { return create(expression, routerRef).evaluate(attributeGroup); } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test public void validateExpressionValid() throws Exception { String predicateOK1 = "language==en;price=in=(20,30,40);price=gt=10;boolTrue==true"; String predicateOK2 = "language==bg,price<100;boolFalse==false"; String predicateOK3 = "language=in=(en,fr,es);prices==30,color==blue"; rsqlEvaluatorFactory.validate(predicateOK1); rsqlEvaluatorFactory.validate(predicateOK2); rsqlEvaluatorFactory.validate(predicateOK3); } | public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void validateExpressionInalid1() throws Exception { String predicateNOK1 = "language===en"; rsqlEvaluatorFactory.validate(predicateNOK1); } | public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void validateExpressionInalid2() throws Exception { String predicateNOK2 = "language==bg:boolFalse==true"; rsqlEvaluatorFactory.validate(predicateNOK2); } | public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test(expected = ExpressionException.class) public void validateExpressionInalid3() throws Exception { String predicateNOK3 = "language==in=(bg,fr,es)"; rsqlEvaluatorFactory.validate(predicateNOK3); } | public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } | RsqlEvaluatorFactory { public void validate(String expression) throws ExpressionException { try { parse(expression); } catch (RSQLParserException ex) { throw new ExpressionException("Invalid expression: " + ex.getMessage()); } } RsqlEvaluatorFactory(CommsRouterEvaluatorFactory factory); Node parse(String expression); void validate(String expression); RsqlEvaluator create(String expression, String routerRef); boolean evaluate(String expression, AttributeGroup attributeGroup, String routerRef); } |
@Test public void testAttributeGroupDtoOK() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("isTechnical", true); attributeGroupDto.add("age", 5.0); attributeGroupDto.add("ageWithBoundary", 18.0); attributeGroupDto.add("multiAgeWithBoundary", 18.0); attributeGroupDto.add("language", "en"); attributeGroupDto.add("nameWithRegex", "suzie"); attributeGroupDto.add("name", "suzie5"); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
@Test(expected = CommsRouterException.class) public void testDoubleUnderInterval() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("ageWithBoundary", 5.0); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
@Test public void testDoubleOnInclusiveBoundary() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("ageWithBoundary", 18.0); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
@Test(expected = BadValueException.class) public void testValidateHighLessThanLow() throws Exception { NumberInterval instance = new NumberInterval( new NumberIntervalBoundary(10.0), new NumberIntervalBoundary(0.0) ); instance.validate(); } | public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } | NumberInterval { public void validate() throws BadValueException { if (low == null) { throw new BadValueException("NumberInterval.low is required"); } if (high == null) { throw new BadValueException("NumberInterval.high is required"); } low.validate(); high.validate(); int compareLowHigh = low.compareBoundaryTo(high); if (compareLowHigh > 0) { throw new BadValueException("NumberInterval.low > NumberInterval.high"); } if (compareLowHigh == 0 && (!low.isInclusive() || !high.isInclusive())) { throw new BadValueException("NumberInterval: when low = high both ends must be inclusive"); } } NumberInterval(); NumberInterval(NumberIntervalBoundary low, NumberIntervalBoundary high); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); void validate(); boolean overlaps(NumberInterval rhs); boolean doesNotOverlap(NumberInterval rhs); boolean contains(Double value); NumberIntervalBoundary getLow(); void setLow(NumberIntervalBoundary low); NumberIntervalBoundary getHigh(); void setHigh(NumberIntervalBoundary high); } |
@Test(expected = CommsRouterException.class) public void testDoubleOnExclusiveBoundary() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("ageWithBoundary", 45.0); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
@Test(expected = CommsRouterException.class) public void testDoubleAboveInterval() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("ageWithBoundary", 46.0); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
@Test public void testDoubleInSecondInterval() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("ageWithBoundary", 55.0); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
@Test(expected = CommsRouterException.class) public void testSkillDoesNotExist() throws CommsRouterException { AttributeGroupDto attributeGroupDto = new AttributeGroupDto(); attributeGroupDto.add("babaiaga", true); skillValidator.validate(attributeGroupDto, routerRef); } | public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } | SkillValidator { public void validate(AttributeGroupDto capabilities, String routerRef) throws CommsRouterException { if (capabilities != null) { for (Map.Entry<String, AttributeValueDto> capability : capabilities.entrySet()) { validateCapability(capability.getKey(), capability.getValue(), routerRef); } } } SkillValidator(CoreSkillService coreSkillService); void validate(AttributeGroupDto capabilities, String routerRef); } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.