Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

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

import de.rub.nds.modifiablevariable.biginteger.*;
import de.rub.nds.modifiablevariable.bytearray.*;
import de.rub.nds.modifiablevariable.integer.*;
import de.rub.nds.modifiablevariable.singlebyte.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.math.BigInteger;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -156,29 +156,20 @@ void testToString() {
/** Test constructor with null value */
@Test
void testConstructorWithNullValue() {
// Using try-catch because we expect an exception
try {
// Explicitly specify null as BigInteger to avoid ambiguity with copy constructor
BigInteger nullValue = null;
new BigIntegerExplicitValueModification(nullValue);
fail("Constructor should throw NullPointerException");
} catch (NullPointerException e) {
// Expected exception
assertTrue(e.getMessage().contains("null"));
}
assertThrows(
NullPointerException.class,
() -> {
new BigIntegerExplicitValueModification((BigInteger) null);
});
}

/** Test setExplicitValue with null value */
@Test
void testSetExplicitValueWithNullValue() {
// Using try-catch because we expect an exception
try {
b1.setExplicitValue(null);
// Should not reach here
fail("setExplicitValue should throw NullPointerException");
} catch (NullPointerException e) {
// Expected exception
assertTrue(e.getMessage().contains("null"));
}
assertThrows(
NullPointerException.class,
() -> {
b1.setExplicitValue(null);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.math.BigInteger;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -166,30 +166,20 @@ void testToString() {
/** Test constructor with null value */
@Test
void testConstructorWithNullValue() {
// Using try-catch because we expect an exception
try {
// Explicitly specify null as BigInteger to avoid ambiguity with copy constructor
BigInteger nullValue = null;
BigIntegerSubtractModification mod = new BigIntegerSubtractModification(nullValue);
// Should not reach here
fail("Constructor should throw NullPointerException");
} catch (NullPointerException e) {
// Expected exception
assertTrue(e.getMessage().contains("null"));
}
assertThrows(
NullPointerException.class,
() -> {
new BigIntegerSubtractModification((BigInteger) null);
});
}

/** Test setSubtrahend with null value */
@Test
void testSetSubtrahendWithNullValue() {
// Using try-catch because we expect an exception
try {
b1.setSubtrahend(null);
// Should not reach here
fail("setSubtrahend should throw NullPointerException");
} catch (NullPointerException e) {
// Expected exception
assertTrue(e.getMessage().contains("null"));
}
assertThrows(
NullPointerException.class,
() -> {
b1.setSubtrahend(null);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.math.BigInteger;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -162,30 +162,20 @@ void testToString() {
/** Test constructor with null value */
@Test
void testConstructorWithNullValue() {
// Using try-catch because we expect an exception
try {
// Explicitly specify null as BigInteger to avoid ambiguity with copy constructor
BigInteger nullValue = null;
new BigIntegerXorModification(nullValue);
// Should not reach here
fail("Constructor should throw NullPointerException");
} catch (NullPointerException e) {
// Expected exception
assertTrue(e.getMessage().contains("null"));
}
assertThrows(
NullPointerException.class,
() -> {
new BigIntegerXorModification((BigInteger) null);
});
}

/** Test setXor with null value */
@Test
void testSetXorWithNullValue() {
// Using try-catch because we expect an exception
try {
b1.setXor(null);
// Should not reach here
fail("setXor should throw NullPointerException");
} catch (NullPointerException e) {
// Expected exception
assertTrue(e.getMessage().contains("null"));
}
assertThrows(
NullPointerException.class,
() -> {
b1.setXor(null);
});
}
}