Skip to content

Commit 15861aa

Browse files
committed
Remove spy use
1 parent f248f45 commit 15861aa

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

.github/workflows/maven.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ jobs:
2525
path: ~/.sonar/cache
2626
key: ${{ runner.os }}-sonar
2727
restore-keys: ${{ runner.os }}-sonar
28-
- name: Verify environment
29-
run: |
30-
uname -a
31-
java -version
3228
- name: Build and analyze
3329
env:
3430
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

weasis-core-img/src/test/java/org/weasis/core/util/StreamUtilTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,19 +626,19 @@ class CopyWithNIOAndCloseTests {
626626

627627
@Test
628628
void should_copy_data_using_nio_and_close_both_streams() throws IOException {
629-
var input = spy(new ByteArrayInputStream(SAMPLE_BYTES));
630-
var output = spy(new ByteArrayOutputStream());
629+
var testData = "Test data for NIO copy".getBytes();
630+
var input = new ByteArrayInputStream(testData);
631+
var output = mock(ByteArrayOutputStream.class);
631632

632633
var result = StreamUtil.copyWithNIOAndClose(input, output, 1024);
633634

634635
assertTrue(result);
635-
verify(input, atLeastOnce()).close();
636636
verify(output, atLeastOnce()).close();
637637
}
638638

639639
@Test
640640
void should_close_streams_even_when_nio_copy_fails() throws IOException {
641-
var output = spy(new ByteArrayOutputStream());
641+
var output = mock(ByteArrayOutputStream.class);
642642

643643
var result = StreamUtil.copyWithNIOAndClose(null, output, 1024);
644644

@@ -648,8 +648,8 @@ void should_close_streams_even_when_nio_copy_fails() throws IOException {
648648

649649
@Test
650650
void should_handle_null_streams() throws IOException {
651-
var output = spy(new ByteArrayOutputStream());
652-
var input = spy(new ByteArrayInputStream(SAMPLE_BYTES));
651+
var output = mock(ByteArrayOutputStream.class);
652+
var input = mock(ByteArrayInputStream.class);
653653

654654
assertFalse(StreamUtil.copyWithNIOAndClose(null, output, 1024));
655655
assertFalse(StreamUtil.copyWithNIOAndClose(input, null, 1024));

0 commit comments

Comments
 (0)