Skip to content

Commit

Permalink
fix junit4 class
Browse files Browse the repository at this point in the history
  • Loading branch information
wadoon committed Jun 26, 2024
1 parent 6b2b6e0 commit 7b72f71
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
* SPDX-License-Identifier: GPL-2.0-only */
package org.key_project.util.collection;

import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class TestSLList {

Expand All @@ -32,19 +33,23 @@ public void testReplace() {
assertEquals("[1,2,3,0]", l.replace(3, 0).toString());
}

@Test(expected = IndexOutOfBoundsException.class)
@Test
public void testReplaceBounds1() {
ImmutableList<Integer> l = ImmutableSLList.<Integer>nil().prepend(1, 2, 3, 4);
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
ImmutableList<Integer> l = ImmutableSLList.<Integer>nil().prepend(1, 2, 3, 4);

System.out.println(l.replace(-1, 0));
System.out.println(l.replace(-1, 0));
});
}

// revealed a bug
@Test(expected = IndexOutOfBoundsException.class)
@Test
public void testReplaceBounds2() {
ImmutableList<Integer> l = ImmutableSLList.<Integer>nil().prepend(1, 2, 3, 4);
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
ImmutableList<Integer> l = ImmutableSLList.<Integer>nil().prepend(1, 2, 3, 4);

System.out.println(l.replace(4, 0));
System.out.println(l.replace(4, 0));
});
}

}

0 comments on commit 7b72f71

Please sign in to comment.