Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * checks whether a user is a daemon user or not
- *
- * however this is not the preferred method for checking to see if the current thread is a daemon thread
- * rather use Daemon.isDeamonThread()
- * the isDaemonThread is preferred for checking to see if you are in that thread or if the current thread is daemon.
- *
- * @param user,
- * @return true if the two uuid values correspond else, false
- * @should user is a daemon one if user Uuid is equal to daemon Uuid
- * @should user is not a daemon one if user Uuid is not equal to daemon Uuid
- */
- public static boolean isDaemonUser(User user) {
- return DAEMON_USER_UUID.equals(user.getUuid());
- }
- /**
- * @see Daemon#isDaemonUser(User)
- * @verifies user is a daemon one if user Uuid is equal to daemon Uuid
- */
- @Test
- public void isDaemonUser_userIsdaemonIfUserUuidIsEqualTodaemonUuid() {
- User user = new User();
- user.setUuid(Daemon.DAEMON_USER_UUID);
- Assert.assertTrue(Daemon.isDaemonUser(user));
- }
- /**
- * @see Daemon#isDaemonUser(User)
- * @verifies user is not a daemon one if user Uuid is not equal to daemon Uuid
- */
- @Test
- public void isDaemonUser_userIsNotdaemonIfUserUuidIsNotEqualTodaemonUuid() {
- User user = new User();
- user.setUuid("any other value");
- Assert.assertFalse(Daemon.isDaemonUser(user));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement