import java.util.Arrays;
import java.util.List;
public class BursarOfficeService {
package edu.nku.csc364.bursar;
public enum ClassStatus {
SENIOR, JUNIOR, SOPHOMORE, FRESHMEN
}
package edu.nku.csc364.bursar;
public class Event {
EventType type;
T data;
public Event(EventType type) {
this(type, null);
}
public Event(EventType type, T data) {
this.type = type;
this.data = data;
}
public EventType getType() {
return type;
}
public T getData() {
return data;
}
}
public void receiveEvent(Event event) {
}
public List runReport() {
return Arrays.asList();
}
}
package edu.nku.csc364.bursar;
public enum EventType {
NEW_REQUEST, REQUEST_COMPLETED;
}
package edu.nku.csc364.bursar;
public class Student {
private String name;
private double gpa;
private ClassStatus status;
private int token;
public Student(String name, double gpa, ClassStatus status) {
this.name = name;
this.gpa = gpa;
this.status = status;
}
public Student(String name, double gpa, int token) {
this.name = name;
this.gpa = gpa;
this.token = token;
}
public String getName() {
return name;
}
public double getGpa() {
return gpa;
}
public ClassStatus getStatus() {
return status;
}
public int getToken() {
return token;
}
public String toString() {
return \"{\" + name + \", \" + gpa + \", \" + status + \", \" + token + \"}\";
}
}
package edu.nku.csc364.bursar;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static edu.nku.csc364.bursar.EventType.NEW_REQUEST;
import static edu.nku.csc364.bursar.EventType.REQUEST_COMPLETED;
import static org.assertj.core.api.Assertions.assertThat;
public class BursarOfficeServiceTest {
BursarOfficeService service;
public void setup() {
service = new BursarOfficeService();
}
public void happyPathExample() {
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"John\", 3.75,
ClassStatus.SENIOR)));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Mark\", 3.8,
ClassStatus.FRESHMEN)));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Shawn\", 3.7,
ClassStatus.JUNIOR)));
service.receiveEvent(new Event<>(REQUEST_COMPLETED));
service.receiveEvent(new Event<>(REQUEST_COMPLETED));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Sam\", 3.85,
ClassStatus.SENIOR)));
service.receiveEvent(new Event<>(REQUEST_COMPLETED));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Ashley\", 3.9,
ClassStatus.SOPHOMORE)));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Mary\", 3.6,
ClassStatus.FRESHMEN)));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Andrew\", 3.95,
ClassStatus.JUNIOR)));
service.receiveEvent(new Event<>(NEW_REQUEST, new Student(\"Dan\", 3.95,
ClassStatus.SENIOR)));
service.receiveEvent(new Event<>(REQUEST_COMPLETED));
List report = service.runReport();
assertThat(report).isNotEmpty();
assertThat(report).hasSize(4);
assertThat(report).containsSequence(\"Andrew\", \"Ashley\", \"Mark\", \"Mary\");
}
}
java.lang.Object
java.util.AbstractCollection
java.util.AbstractQueu.