Skip to content

Commit 394ec82

Browse files
committed
Formatted
1 parent fa52b9f commit 394ec82

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

src/main/java/de/rub/nds/modifiablevariable/bytearray/ModifiableByteArray.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
* @author Matthias Terlinde - <matthias.terlinde@rub.de>
2626
*/
2727
@XmlRootElement
28-
@XmlSeeAlso({ByteArrayDeleteModification.class, ByteArrayExplicitValueModification.class,
29-
ByteArrayInsertModification.class, ByteArrayXorModification.class, ByteArrayDuplicateModification.class})
30-
@XmlType(propOrder = {"originalValue", "modification", "assertEquals"})
28+
@XmlSeeAlso({ ByteArrayDeleteModification.class, ByteArrayExplicitValueModification.class,
29+
ByteArrayInsertModification.class, ByteArrayXorModification.class, ByteArrayDuplicateModification.class })
30+
@XmlType(propOrder = { "originalValue", "modification", "assertEquals" })
3131
public class ModifiableByteArray extends ModifiableVariable<byte[]> implements Serializable {
3232

3333
private byte[] originalValue;

src/main/java/de/rub/nds/modifiablevariable/util/BadFixedRandom.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import java.util.Random;
1212

1313
/**
14-
* A fake random number generator for testing.
15-
* This generator will always return the byte "retVal" passed to the constructor.
14+
* A fake random number generator for testing. This generator will always return
15+
* the byte "retVal" passed to the constructor.
1616
*
1717
*/
1818
public class BadFixedRandom extends Random {
@@ -24,9 +24,10 @@ public BadFixedRandom(byte retVal) {
2424
}
2525

2626
/**
27-
* Fills a user-supplied byte array with the fixed byte given at object initialization.
28-
* The number of "random" bytes produced is equal to the length of the byte array.
29-
*/
27+
* Fills a user-supplied byte array with the fixed byte given at object
28+
* initialization. The number of "random" bytes produced is equal to the
29+
* length of the byte array.
30+
*/
3031
@Override
3132
public void nextBytes(byte[] bytes) {
3233
for (int i = 0, len = bytes.length; i < len;)

src/test/java/de/rub/nds/modifiablevariable/bytearray/ModifiableByteArrayTest.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public class ModifiableByteArrayTest {
3939

4040
@Before
4141
public void setUp() {
42-
originalValue = new byte[]{(byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6};
43-
modification1 = new byte[]{(byte) 2, (byte) 3};
44-
modification2 = new byte[]{(byte) 2, (byte) 1, (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5,
45-
(byte) 6};
42+
originalValue = new byte[] { (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6 };
43+
modification1 = new byte[] { (byte) 2, (byte) 3 };
44+
modification2 = new byte[] { (byte) 2, (byte) 1, (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5,
45+
(byte) 6 };
4646
start = new ModifiableByteArray();
4747
start.setOriginalValue(originalValue);
4848
}
@@ -362,13 +362,13 @@ public void testInsertBytes() {
362362
@Test
363363
public void testIsOriginalValueModified() {
364364
assertFalse(start.isOriginalValueModified());
365-
VariableModification<byte[]> modifier = ByteArrayModificationFactory.xor(new byte[]{}, 0);
365+
VariableModification<byte[]> modifier = ByteArrayModificationFactory.xor(new byte[] {}, 0);
366366
start.setModification(modifier);
367367
assertFalse(start.isOriginalValueModified());
368-
modifier = ByteArrayModificationFactory.xor(new byte[]{1}, 0);
368+
modifier = ByteArrayModificationFactory.xor(new byte[] { 1 }, 0);
369369
start.setModification(modifier);
370370
assertTrue(start.isOriginalValueModified());
371-
modifier = ByteArrayModificationFactory.xor(new byte[]{0, 0}, originalValue.length - 2);
371+
modifier = ByteArrayModificationFactory.xor(new byte[] { 0, 0 }, originalValue.length - 2);
372372
start.setModification(modifier);
373373
assertFalse(start.isOriginalValueModified());
374374
}
@@ -399,13 +399,13 @@ public void testExplicitValueFromFile() {
399399

400400
modifier = ByteArrayModificationFactory.explicitValueFromFile(1);
401401
start.setModification(modifier);
402-
expectedResult = new byte[]{00};
402+
expectedResult = new byte[] { 00 };
403403
result = start.getValue();
404404
assertArrayEquals(expectedResult, result);
405405

406406
modifier = ByteArrayModificationFactory.explicitValueFromFile(17);
407407
start.setModification(modifier);
408-
expectedResult = new byte[]{(byte) 255};
408+
expectedResult = new byte[] { (byte) 255 };
409409
result = start.getValue();
410410
assertArrayEquals(expectedResult, result);
411411
}
@@ -416,30 +416,32 @@ public void testExplicitValueFromFile() {
416416
@Test
417417
public void testShuffle() {
418418
LOGGER.info("testShuffle");
419-
VariableModification<byte[]> modifier = ByteArrayModificationFactory.shuffle(new byte[]{0, 1});
419+
VariableModification<byte[]> modifier = ByteArrayModificationFactory.shuffle(new byte[] { 0, 1 });
420420
start.setModification(modifier);
421-
byte[] result = {1, 0, 2, 3, 4, 5, 6};
421+
byte[] result = { 1, 0, 2, 3, 4, 5, 6 };
422422
assertArrayEquals(result, start.getValue());
423423

424-
modifier = ByteArrayModificationFactory.shuffle(new byte[]{0, 1, 2, 3, 4, 5, 6});
424+
modifier = ByteArrayModificationFactory.shuffle(new byte[] { 0, 1, 2, 3, 4, 5, 6 });
425425
start.setModification(modifier);
426-
result = new byte[]{1, 0, 3, 2, 5, 4, 6};
426+
result = new byte[] { 1, 0, 3, 2, 5, 4, 6 };
427427
assertArrayEquals(result, start.getValue());
428428

429-
modifier = ByteArrayModificationFactory.shuffle(new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
429+
modifier = ByteArrayModificationFactory.shuffle(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 });
430430
start.setModification(modifier);
431-
result = new byte[]{6, 0, 3, 2, 5, 4, 1};
431+
result = new byte[] { 6, 0, 3, 2, 5, 4, 1 };
432432
assertArrayEquals(result, start.getValue());
433433
}
434434

435435
@Test
436436
public void toStringTest() {
437437
ModifiableByteArray toTest = new ModifiableByteArray();
438-
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[]{0x00, 0x11, 0x22, 0x33, 0x44});
438+
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[] { 0x00, 0x11, 0x22, 0x33, 0x44 });
439439
assertEquals("Original byte value is: 00 11 22 33 44", toTest.toString());
440440

441-
VariableModification modificatoin = new ByteArrayExplicitValueModification(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08});
441+
VariableModification modificatoin = new ByteArrayExplicitValueModification(new byte[] { 0x00, 0x01, 0x02, 0x03,
442+
0x04, 0x05, 0x06, 0x07, 0x08 });
442443
toTest.setModification(modificatoin);
443-
assertEquals("Actual byte value is: 00 01 02 03 04 05 06 07 08\nOriginal value was: 00 11 22 33 44", toTest.toString());
444+
assertEquals("Actual byte value is: 00 01 02 03 04 05 06 07 08\nOriginal value was: 00 11 22 33 44",
445+
toTest.toString());
444446
}
445447
}

src/test/java/de/rub/nds/modifiablevariable/util/ArrayConverterTest.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,21 +219,24 @@ public void testLongToUint48Bytes() {
219219
@Test
220220
public void testBytesToHexString_ModifiableByteArray() {
221221
ModifiableByteArray toTest = new ModifiableByteArray();
222-
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[]{0x00, 0x11, 0x22, 0x33, 0x44});
222+
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[] { 0x00, 0x11, 0x22, 0x33, 0x44 });
223223
assertEquals("00 11 22 33 44", ArrayConverter.bytesToHexString(toTest));
224224

225-
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08});
225+
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
226+
0x06, 0x07, 0x08 });
226227
assertEquals("00 01 02 03 04 05 06 07 08", ArrayConverter.bytesToHexString(toTest));
227228

228-
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10});
229+
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
230+
0x06, 0x07, 0x08, 0x09, 0x10 });
229231
assertEquals("00 01 02 03 04 05 06 07 08 09 10", ArrayConverter.bytesToHexString(toTest));
230232

231-
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
232-
0x07,});
233+
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
234+
0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, });
233235
assertEquals("\n00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07", ArrayConverter.bytesToHexString(toTest));
234236

235-
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
236-
0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,});
237+
toTest = ModifiableVariableFactory.safelySetValue(toTest, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
238+
0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
239+
0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, });
237240
assertEquals(
238241
"\n00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07\n00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07",
239242
ArrayConverter.bytesToHexString(toTest));

0 commit comments

Comments
 (0)