We are about to switch to a new forum software. Until then we have removed the registration on this forum.
void instantiateMatrix(){
boolean errorFlag = false;
try {
Matrix m = new Matrix(new String("4;4;2;5"), 2, 2);
m.showMatrix();
} catch(java.lang.RuntimeException e) {
errorFlag = true;
} finally {
if (!errorFlag){
println("Test 1: Success");
} else{
println("Test 1: Failure");
}
}
I'm trying to unit test my matrix math class (and other classes), and this code snippet is testing the overloaded constructor of the Matrix. The problem is that even if no exception occurs ( a runtime error doesn't occur) the catch statement is still executed.
Answers
What do you mean by collisions still occur?
This would be a lot easier to see what was going on with the inclusion of 3 println statements.
@koogs sorry for the typo, I fixed it now
so, after line 7 add
e.printStackTrace();
tell us what it says.
runnable examples are always better. here the problem looks to be in you matrix class which we don't have.