GradeHistory.java

1
package edu.ucsb.cs156.courses.entities;
2
3
import javax.persistence.Entity;
4
import javax.persistence.GeneratedValue;
5
import javax.persistence.GenerationType;
6
import javax.persistence.Id;
7
import javax.persistence.Table;
8
import javax.persistence.UniqueConstraint;
9
import lombok.AllArgsConstructor;
10
import lombok.Builder;
11
import lombok.Data;
12
import lombok.NoArgsConstructor;
13
14
/**
15
 * GradeHistory - Entity for grade history data. Each object represents one row from the CSV files
16
 * located in this repository: <a
17
 * href="https://github.com/rtora/UCSB_Grades">https://github.com/rtora/UCSB_Grades</a>
18
 *
19
 * <p>There is a unique constraint on the combination of year, quarter, subjectArea, course,
20
 * instructor, and grade, since we do not want duplicate rows of data for the same course.
21
 */
22
@Data
23
@Builder
24
@AllArgsConstructor
25
@NoArgsConstructor
26
@Entity(name = "historygrade")
27
@Table(
28
    uniqueConstraints = {
29
      @UniqueConstraint(
30
          name = "UniqueGradeHistory",
31
          columnNames = {"yyyyq", "course", "instructor", "grade", "count"})
32
    })
33
public class GradeHistory {
34
  @Id
35
  @GeneratedValue(strategy = GenerationType.IDENTITY)
36
  private Long id;
37
38
  private String yyyyq;
39
  private String course;
40
  private String instructor;
41
  private String grade;
42
  private int count;
43
44
  public String getSubjectArea() {
45 2 1. getSubjectArea : negated conditional → KILLED
2. getSubjectArea : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getSubjectArea → KILLED
    if (course == null) return null;
46 1 1. getSubjectArea : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getSubjectArea → KILLED
    return course.substring(0, 8).trim();
47
  }
48
49
  public String getCourseNum() {
50 2 1. getCourseNum : negated conditional → KILLED
2. getCourseNum : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getCourseNum → KILLED
    if (course == null) return null;
51 1 1. getCourseNum : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getCourseNum → KILLED
    return course.substring(8).trim();
52
  }
53
}

Mutations

45

1.1
Location : getSubjectArea
Killed by : edu.ucsb.cs156.courses.entities.GradeHistoryTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.entities.GradeHistoryTests]/[method:test_getSubjectArea_and_getCourseNum_null()]
negated conditional → KILLED

2.2
Location : getSubjectArea
Killed by : edu.ucsb.cs156.courses.entities.GradeHistoryTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.entities.GradeHistoryTests]/[method:test_getSubjectArea_and_getCourseNum_null()]
replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getSubjectArea → KILLED

46

1.1
Location : getSubjectArea
Killed by : edu.ucsb.cs156.courses.entities.GradeHistoryTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.entities.GradeHistoryTests]/[method:test_getSubjectArea_and_getCourseNum_CMPSC_130A()]
replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getSubjectArea → KILLED

50

1.1
Location : getCourseNum
Killed by : edu.ucsb.cs156.courses.entities.GradeHistoryTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.entities.GradeHistoryTests]/[method:test_getSubjectArea_and_getCourseNum_null()]
negated conditional → KILLED

2.2
Location : getCourseNum
Killed by : edu.ucsb.cs156.courses.entities.GradeHistoryTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.entities.GradeHistoryTests]/[method:test_getSubjectArea_and_getCourseNum_null()]
replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getCourseNum → KILLED

51

1.1
Location : getCourseNum
Killed by : edu.ucsb.cs156.courses.entities.GradeHistoryTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.entities.GradeHistoryTests]/[method:test_getSubjectArea_and_getCourseNum_CMPSC_130A()]
replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getCourseNum → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3