Last active
September 29, 2016 03:36
-
-
Save usbportnoy/3f88f66e485d289035f18440f3c89556 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ProfileOnlineStatusTest { | |
| @Test | |
| public void this_week() throws Exception { | |
| Profile profile = new Profile(); | |
| //sets instance to right now | |
| Calendar calendar = Calendar.getInstance(); | |
| // 6 days is less than a week | |
| calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - 6); | |
| //get time of right now and set users online status with it | |
| profile.setLastOnline(calendar.getTime()); | |
| //create and configure | |
| OnlineStatus onlineStatus = new OnlineStatus(); | |
| onlineStatus.setOnlineThresholdHrs(1); | |
| onlineStatus.setRecentOnlineThresholdDays(7); | |
| OnlineStatus.States status = onlineStatus.getStatus( | |
| profile.getLastOnline(), | |
| Calendar.getInstance() | |
| ); | |
| assertEquals(OnlineStatus.States.Recent, status); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment