Skip to content

Instantly share code, notes, and snippets.

@usbportnoy
Created September 28, 2016 05:07
Show Gist options
  • Select an option

  • Save usbportnoy/d1bd5fa99ed0fa13ecb69bdaec3ab055 to your computer and use it in GitHub Desktop.

Select an option

Save usbportnoy/d1bd5fa99ed0fa13ecb69bdaec3ab055 to your computer and use it in GitHub Desktop.
@Test
public void onlineTest() throws Exception {
Profile profile = new Profile();
//sets instance to right now
Calendar calendar = Calendar.getInstance();
//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.States status = onlineStatus.getStatus(
profile.getLastOnline(),
calendar
);
assertEquals(status, OnlineStatus.States.Online);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment