diff --git a/tp1/TeachingUnitResult.java b/tp1/TeachingUnitResult.java index c052586a62e9513c55979121bb6ff8b67972fc71..ef76d75d78f3646cb8d1e9043d4f3e8d4fdb5ead 100644 --- a/tp1/TeachingUnitResult.java +++ b/tp1/TeachingUnitResult.java @@ -26,6 +26,7 @@ public class TeachingUnitResult { * @return the grade associated to the result */ public Grade getGrade() { + return this.grade; } /** @@ -34,5 +35,14 @@ public class TeachingUnitResult { */ @Override public String toString() { + return this.teachingUnitName; } + + public boolean equals(Grade grade){ + if (this.grade.getValue() == grade.getValue()){ + return true; + } + return false; + } + } diff --git a/tp1/TestTeachingUnitResult.java b/tp1/TestTeachingUnitResult.java new file mode 100644 index 0000000000000000000000000000000000000000..a14026ca01edcbfb3ed9937660ab184f11faa41f --- /dev/null +++ b/tp1/TestTeachingUnitResult.java @@ -0,0 +1,37 @@ +public class TestTeachingUnitResult { + public static void main(String[] args) { + TestTeachingUnitResult test = new TestTeachingUnitResult(); + + if (test.TestToString()){ + System.out.println("ok"); + } + System.out.println(test.TestEquals()); + + + } + + + + public boolean TestToString(){ + TeachingUnitResult teachingUnitResult = new TeachingUnitResult("programmation2", new Grade(0)); + String teachingUnitResultString = teachingUnitResult.toString(); + if(teachingUnitResultString == "programmation2"){ + return true; + } + return false; + } + + public boolean TestEquals(){ + TeachingUnitResult teachingUnitResult = new TeachingUnitResult("",new Grade(15)); + TeachingUnitResult teachingUnitResult1 = new TeachingUnitResult( "", new Grade(15)); + if(teachingUnitResult.equals(teachingUnitResult1.getGrade())) + { + return true; + } + return false; + } + + + + +} \ No newline at end of file