Section.java

1
package edu.ucsb.cs156.courses.documents;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import java.util.List;
5
import java.util.stream.Collectors;
6
import lombok.AllArgsConstructor;
7
import lombok.Builder;
8
import lombok.Data;
9
import lombok.NoArgsConstructor;
10
11
@Data
12
@Builder
13
@AllArgsConstructor
14
@NoArgsConstructor
15
public class Section implements Cloneable {
16
17
  /** a unique number assigned to a section */
18
  private String enrollCode;
19
20
  /** section number of the course */
21
  private String section;
22
23
  /** session only for summer quarter */
24
  private String session;
25
26
  /** if the class is closed */
27
  private String classClosed;
28
29
  /** is course cancelled */
30
  private String courseCancelled;
31
32
  public String status() {
33 2 1. status : negated conditional → KILLED
2. status : negated conditional → KILLED
    if (courseCancelled != null && courseCancelled.equals("Y")) {
34 1 1. status : replaced return value with "" for edu/ucsb/cs156/courses/documents/Section::status → KILLED
      return "Cancelled";
35
    }
36 2 1. status : negated conditional → KILLED
2. status : negated conditional → KILLED
    if (classClosed != null && classClosed.equals("Y")) {
37 1 1. status : replaced return value with "" for edu/ucsb/cs156/courses/documents/Section::status → KILLED
      return "Closed";
38
    }
39
    return "";
40
  }
41
42
  /**
43
   * Grading Options Code like Pass/No Pass (P/NP) Or Letter Grades (L).
44
   *
45
   * @see <a href= "https://developer.ucsb.edu/content/student-record-code-lookups">
46
   *     https://developer.ucsb.edu/content/student-record-code-lookups</a>
47
   */
48
  private String gradingOptionCode;
49
50
  /** total number of enrollments in the course */
51
  private Integer enrolledTotal;
52
53
  /** max number of students can be enrolled in the section */
54
  private Integer maxEnroll;
55
56
  /** Secondary Status of the course */
57
  private String secondaryStatus;
58
59
  /** Is department approval required for enrollment in the section */
60
  private boolean departmentApprovalRequired;
61
62
  /** Is instructor approval required for enrollment in the section */
63
  private boolean instructorApprovalRequired;
64
65
  /** Is there restriction on the level of the course */
66
  private String restrictionLevel;
67
68
  /** Is there restriction on the major of the student */
69
  private String restrictionMajor;
70
71
  /** Is there restriction on the major and pass time of the student */
72
  private String restrictionMajorPass;
73
74
  /** Is there restriction on the minor of the student */
75
  private String restrictionMinor;
76
77
  /** Is there restriction on the minor and pass time of the student */
78
  private String restrictionMinorPass;
79
80
  /** Concurrent courses for the section */
81
  private List<String> concurrentCourses;
82
83
  /** List of {@link TimeLocation} objects for this course */
84
  private List<TimeLocation> timeLocations;
85
86
  /** List of {@link Instructor} objects for this course */
87
  private List<Instructor> instructors;
88
89
  public String instructorList() {
90 1 1. instructorList : negated conditional → KILLED
    if (instructors == null) {
91
      return "";
92
    }
93
    List<String> listOfInstructorNames =
94
        instructors.stream().map(Instructor::getInstructor).collect(Collectors.toList());
95 1 1. instructorList : replaced return value with "" for edu/ucsb/cs156/courses/documents/Section::instructorList → KILLED
    return String.join(", ", listOfInstructorNames);
96
  }
97
98
  public Object clone() throws CloneNotSupportedException {
99
100
    Section newSection = (Section) super.clone();
101 1 1. clone : replaced return value with null for edu/ucsb/cs156/courses/documents/Section::clone → KILLED
    return newSection;
102
  }
103
104
  /**
105
   * Check if the section is a primary section (i.e. section number ends with "00").
106
   *
107
   * @return true if the section is a primary section, false otherwise
108
   */
109
  @JsonIgnore
110
  public boolean isPrimary() {
111 3 1. isPrimary : negated conditional → KILLED
2. isPrimary : negated conditional → KILLED
3. isPrimary : replaced boolean return with true for edu/ucsb/cs156/courses/documents/Section::isPrimary → KILLED
    return section != null && section.matches("\\d+00");
112
  }
113
}

Mutations

33

1.1
Location : status
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_status()]
negated conditional → KILLED

2.2
Location : status
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_status()]
negated conditional → KILLED

34

1.1
Location : status
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_status()]
replaced return value with "" for edu/ucsb/cs156/courses/documents/Section::status → KILLED

36

1.1
Location : status
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_status()]
negated conditional → KILLED

2.2
Location : status
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_status()]
negated conditional → KILLED

37

1.1
Location : status
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_status()]
replaced return value with "" for edu/ucsb/cs156/courses/documents/Section::status → KILLED

90

1.1
Location : instructorList
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_instructorlist()]
negated conditional → KILLED

95

1.1
Location : instructorList
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_instructorlist()]
replaced return value with "" for edu/ucsb/cs156/courses/documents/Section::instructorList → KILLED

101

1.1
Location : clone
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_clone()]
replaced return value with null for edu/ucsb/cs156/courses/documents/Section::clone → KILLED

111

1.1
Location : isPrimary
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_isPrimary()]
negated conditional → KILLED

2.2
Location : isPrimary
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_isPrimary()]
negated conditional → KILLED

3.3
Location : isPrimary
Killed by : edu.ucsb.cs156.courses.documents.SectionTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.documents.SectionTests]/[method:test_isPrimary()]
replaced boolean return with true for edu/ucsb/cs156/courses/documents/Section::isPrimary → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0