| Summary: | java.lang.ClassCastException: at Pbomb.java:19 for any class that is not a Pbomb | ||
|---|---|---|---|
| Product: | Group 8 | Reporter: | pchatterj2 |
| Component: | Main | Assignee: | pchatterj2 |
| Status: | CONFIRMED --- | ||
| Severity: | critical | CC: | pchatterj2, yongjiawu5-c |
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Attachments: |
Test of the offending method with a test case
bugfix : only does a class cast if the class is the same |
||
|
Description
pchatterj2
2017-11-26 17:07:17 HKT
Created attachment 3 [details]
Test of the offending method with a test case
Bug confirmed with the above testcase
Created attachment 4 [details]
bugfix : only does a class cast if the class is the same
Resolved.
Note that the classcast exception must be checked for in other testcases as well, and is significant here because the test stub extends the actual PDoubleStraight class Note that the classcast exception must be checked for in other testcases as well, and is significant here because the test stub extends the actual PDoubleStraight class Confirmed with second testcase
class PbombTest {
Pbomb thisBomb = new Pbomb(3);
@Test
public void isLarger1() {
ArrayList<Integer> thisListOfValues = new ArrayList<>();
for(int i = 0; i< 5; i++) {
thisListOfValues.add(i + 1);
thisListOfValues.add(i + 1);
}
PdoubleStraight another = new PdoubleStraight(thisListOfValues);
boolean result = thisBomb.isLarger(another);
assertEquals(true, result);
}
}
|