|
3 | 3 | import com.dvf.ucst.core.courseutils.CourseSectionBlock.BlockTimeEnclosure; |
4 | 4 | import com.dvf.ucst.core.courseutils.CourseSectionBlock.IllegalTimeEnclosureException; |
5 | 5 | import com.dvf.ucst.core.courseutils.UbcTimeUtils.BlockTime; |
| 6 | +import com.dvf.ucst.core.spider.CourseWip.CourseSectionWip.CourseSectionBlockWip; |
| 7 | +import com.dvf.ucst.utils.general.WorkInProgress; |
| 8 | +import org.junit.jupiter.api.Assertions; |
| 9 | +import org.junit.jupiter.api.Nested; |
6 | 10 | import org.junit.jupiter.api.Test; |
| 11 | +import org.junit.jupiter.api.function.ThrowingSupplier; |
7 | 12 |
|
8 | 13 | import java.util.ArrayList; |
9 | 14 | import java.util.List; |
|
15 | 20 |
|
16 | 21 | class CourseSectionBlockTest { |
17 | 22 |
|
| 23 | + @Test |
| 24 | + void test() { |
| 25 | + |
| 26 | + } |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + /** |
| 31 | + * |
| 32 | + */ |
| 33 | + @Nested |
| 34 | + final class CourseSectionBlockWipTest { |
| 35 | + |
| 36 | + @Test |
| 37 | + void makeWip() { |
| 38 | + final CourseSectionBlockWip blockWip = new CourseSectionBlockWip() |
| 39 | + .setBeginTime(T0800) |
| 40 | + .setEndTime(T0900) |
| 41 | + .setRepetitionType(CourseSectionBlock.BlockRepetition.EVERY_WEEK) |
| 42 | + .setWeekDay(CourseUtils.WeekDay.MONDAY); |
| 43 | + final Set<ThrowingSupplier<Object>> getters = Set.of( |
| 44 | + blockWip::getBeginTime, |
| 45 | + blockWip::getEndTime, |
| 46 | + blockWip::getRepetitionType, |
| 47 | + blockWip::getWeekDay |
| 48 | + ); |
| 49 | + getters.forEach(Assertions::assertDoesNotThrow); |
| 50 | + } |
| 51 | + |
| 52 | + @Test |
| 53 | + void assertThrowsIncomplete() { |
| 54 | + // make a block wip and don't populate its fields: |
| 55 | + final CourseSectionBlockWip blockWip = new CourseSectionBlockWip(); |
| 56 | + final Set<ThrowingSupplier<Object>> getters = Set.of( |
| 57 | + blockWip::getBeginTime, |
| 58 | + blockWip::getEndTime, |
| 59 | + blockWip::getRepetitionType, |
| 60 | + blockWip::getWeekDay |
| 61 | + ); |
| 62 | + getters.forEach(getter -> assertThrows( |
| 63 | + WorkInProgress.IncompleteWipException.class, |
| 64 | + getter::get |
| 65 | + )); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + |
| 70 | + |
18 | 71 | /** |
19 | 72 | * Tests for the private class [BlockTimeEnclosure] |
20 | 73 | */ |
21 | | - static final class BlockTimeEnclosureTest { |
| 74 | + @Nested |
| 75 | + final class BlockTimeEnclosureTest { |
22 | 76 |
|
23 | 77 | @Test |
24 | 78 | void assertNoOverlaps() { |
@@ -115,7 +169,7 @@ void assertIllegalEnclosure() { |
115 | 169 | } |
116 | 170 |
|
117 | 171 | // for sake of brevity: |
118 | | - private static BlockTimeEnclosure bte( |
| 172 | + private BlockTimeEnclosure bte( |
119 | 173 | final BlockTime begin, |
120 | 174 | final BlockTime end |
121 | 175 | ) throws IllegalTimeEnclosureException { |
|
0 commit comments