Search in sources :

Example 6 with DiscussionAttachment

use of com.instructure.canvasapi2.models.DiscussionAttachment in project instructure-android by instructure.

the class DiscussionAttachmentTest method shouldShowToUser_hidden.

@Test
public void shouldShowToUser_hidden() {
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setHidden(true);
    assertEquals(false, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Test(org.junit.Test)

Example 7 with DiscussionAttachment

use of com.instructure.canvasapi2.models.DiscussionAttachment in project instructure-android by instructure.

the class DiscussionAttachmentTest method shouldShowToUser_locked_noUnlockDate.

@Test
public void shouldShowToUser_locked_noUnlockDate() {
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setLocked(true);
    attachment.setUnlockAt(null);
    assertEquals(false, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Test(org.junit.Test)

Example 8 with DiscussionAttachment

use of com.instructure.canvasapi2.models.DiscussionAttachment in project instructure-android by instructure.

the class DiscussionAttachmentTest method shouldShowToUser_locked_unlockDateNotPassed.

@Test
public void shouldShowToUser_locked_unlockDateNotPassed() {
    Date lockDate = new Date(System.currentTimeMillis() + MILLIS_PER_DAY);
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setUnlockAt(APIHelper.dateToString(lockDate));
    attachment.setLocked(true);
    assertEquals(false, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Date(java.util.Date) Test(org.junit.Test)

Example 9 with DiscussionAttachment

use of com.instructure.canvasapi2.models.DiscussionAttachment in project instructure-android by instructure.

the class DiscussionAttachmentTest method shouldShowToUser_locked_unlockDatePassed.

@Test
public void shouldShowToUser_locked_unlockDatePassed() {
    Date lockDate = new Date(System.currentTimeMillis() - MILLIS_PER_DAY);
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setUnlockAt(APIHelper.dateToString(lockDate));
    attachment.setLocked(true);
    assertEquals(true, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Date(java.util.Date) Test(org.junit.Test)

Aggregations

DiscussionAttachment (com.instructure.canvasapi2.models.DiscussionAttachment)9 Test (org.junit.Test)9 Date (java.util.Date)4