I hereby claim:
- I am usbportnoy on github.
- I am usbport (https://keybase.io/usbport) on keybase.
- I have a public key ASDcaSD62bzrdjtsFPNQ-0zKTBu0h8-vhIXuEuH7cAxdMQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| package com.dkary.portj.danichat; | |
| import com.dkary.portj.danichat.fragments.profile.OnlineStatus; | |
| import com.dkary.portj.danichat.models.Profile; | |
| import org.junit.Test; | |
| import static org.junit.Assert.assertEquals; | |
| import java.util.Calendar; |
| package com.dkary.portj.danichat.fragments.profile; | |
| import java.util.Calendar; | |
| import java.util.Date; | |
| public class OnlineStatus { | |
| public enum States {Unknown, Online, Distant, Recent, Offline;} | |
| private int recentOnlineThresholdDays; | |
| private int onlineThresholdHrs; |
| public class OnlineStatus { | |
| private int recentOnlineThresholdDays; | |
| private int onlineThresholdHrs; | |
| public enum States {Unknown, Online, Recent} | |
| public void setOnlineThresholdHrs(int hours) { | |
| this.onlineThresholdHrs = hours; | |
| } |
| public class OnlineStatus { | |
| private int recentOnlineThresholdDays; | |
| private int onlineThresholdHrs; | |
| public enum States {Unknown, Online, Recent} | |
| public void setOnlineThresholdHrs(int hours) { | |
| this.onlineThresholdHrs = hours; | |
| } |
| 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 |
| public class OnlineStatus { | |
| public enum States {Unknown, Online} | |
| private int onlineThresholdHrs; | |
| public void setOnlineThresholdHrs(int hours) { | |
| this.onlineThresholdHrs = hours; | |
| } | |
| public States getStatus(Date lastOnline, Calendar calendar) { |
| @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 |
| Calendar rightNow = Calendar.getInstance(); |
| public class Profile { | |
| Date lastOnline; | |
| public Date getLastOnline() { | |
| return lastOnline; | |
| } | |
| public void setLastOnline(Date lastOnline) { | |
| this.lastOnline = lastOnline; | |
| } |