001package edu.pdx.cs.joy.junit; 002 003import org.junit.jupiter.api.Test; 004 005import static org.junit.jupiter.api.Assertions.assertEquals; 006import static org.junit.jupiter.api.Assertions.assertThrows; 007 008/** 009 * This class tests the functionality of the <code>Section</code> class 010 */ 011class SectionTest { 012 013 @Test 014 void testAddStudent() { 015 Student student = new Student("123-45-6789"); 016 Course course = new Course("CS", 410, 4); 017 Section section = 018 new Section(course, Section.SUMMER, 2021); 019 section.addStudent(student); 020 assertEquals(1, section.getClassSize()); 021 } 022 023 @Test 024 void testDropStudentNotEnrolled() { 025 Student student = new Student("123-45-6789"); 026 Course course = new Course("CS", 410, 4); 027 Section section = 028 new Section(course, Section.SUMMER, 2021); 029 assertThrows(IllegalArgumentException.class, () -> section.dropStudent(student)); 030 } 031 032}