Skip to content

Commit

Permalink
Proper user of assertj assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
pibizza committed Sep 5, 2024
1 parent e873768 commit 8fb4762
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions drools-mvel/src/test/java/org/drools/mvel/BuildUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,12 @@ public void testCalculateTemporalDistance() {
and.addChild( not );

TemporalDependencyMatrix matrix = utils.calculateTemporalDistance( and );
//printMatrix( matrix.getMatrix() );
assertEqualsMatrix( expected, matrix.getMatrix() );


assertThat(matrix.getMatrix()).isDeepEqualTo(expected);
assertThat(matrix.getExpirationOffset(a)).isEqualTo(15);
assertThat(matrix.getExpirationOffset(d)).isEqualTo(11);
assertThat(matrix.getExpirationOffset(e)).isEqualTo(1);

}

public void assertEqualsMatrix( Interval[][] expected, Interval[][] matrix ) {
for( int i = 0; i < matrix.length; i++ ) {
for( int j = 0; j < matrix[i].length; j++ ) {
assertThat(matrix[i][j]).as("Wrong value at (" + i + ", " + j).isEqualTo(expected[i][j]);
}
}
}

public void printMatrix( Interval[][] matrix ) {
System.out.println("------------------------------------------------------------------");
for( int i = 0; i < matrix.length; i++ ) {
System.out.print("| ");
for( int j = 0; j < matrix[i].length; j++ ) {
System.out.print( matrix[i][j] + " ");
}
System.out.println("|");
}
System.out.println("------------------------------------------------------------------");
}

}

0 comments on commit 8fb4762

Please sign in to comment.