Skip to content

Commit 7153117

Browse files
committed
Minor refactorings
1 parent 56b867d commit 7153117

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/main/java/at/favre/lib/bytes/MutableBytes.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public boolean isMutable() {
5151
* @throws IndexOutOfBoundsException if newArray.length > internal length
5252
*/
5353
public MutableBytes overwrite(byte[] newArray) {
54-
overwrite(newArray, 0);
55-
return this;
54+
return overwrite(newArray, 0);
5655
}
5756

5857
/**
@@ -87,8 +86,7 @@ public MutableBytes setByteAt(int index, byte newByte) {
8786
* @return this instance
8887
*/
8988
public MutableBytes wipe() {
90-
fill((byte) 0);
91-
return this;
89+
return fill((byte) 0);
9290
}
9391

9492
/**
@@ -108,8 +106,7 @@ public MutableBytes fill(byte fillByte) {
108106
* @return this instance
109107
*/
110108
public MutableBytes secureWipe() {
111-
secureWipe(new SecureRandom());
112-
return this;
109+
return secureWipe(new SecureRandom());
113110
}
114111

115112
/**

src/test/java/at/favre/lib/bytes/ABytesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import static org.junit.Assert.*;
2929

30-
abstract class ABytesTest {
30+
public abstract class ABytesTest {
3131
byte[] example_bytes_empty;
3232

3333
byte[] example_bytes_one;

src/test/java/at/favre/lib/bytes/MutableBytesTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public void setByteAtTest() {
106106

107107
for (int i = 0; i < b.length(); i++) {
108108
byte old = b.byteAt(i);
109-
b.setByteAt(i, (byte) 0);
109+
MutableBytes bcopy = b.setByteAt(i, (byte) 0);
110+
assertSame(b, bcopy);
110111
if (old != 0) {
111112
assertNotEquals(old, b.byteAt(i));
112113
}

0 commit comments

Comments
 (0)