Tibor17 commented on code in PR #518: URL: https://github.com/apache/maven-surefire/pull/518#discussion_r848513301
########## surefire-api/src/test/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoderTest.java: ########## @@ -258,6 +258,56 @@ public void shouldReadString() throws Exception .isEqualTo( "0123456789" ); } + @Test + public void shouldReadStringOverflowOnNewLine() throws Exception + { + StringBuilder s = new StringBuilder( 1025 ); + for ( int i = 0; i < 10; i++ ) + { + s.append( PATTERN1 ); + } + s.append( PATTERN1, 0, 23 ); + s.append( "\u00FA\n" ); // 2-bytes encoded character + LF + + Channel channel = new Channel( s.toString().getBytes( UTF_8 ), s.length() ); + + Mock thread = new Mock( channel, new MockForkNodeArguments(), + Collections.<Segment, ForkedProcessEventType>emptyMap() ); + + Memento memento = thread.new Memento(); + + assertThat( (String) invokeMethod( thread, "readString", memento, 1026 ) ) + .isEqualTo( s.toString() ); + + assertThat ( memento.getByteBuffer().remaining() ) + .isEqualTo( 0 ); + } + + @Test + public void shouldReadStringOverflowOn4BytesEncodedSymbol() throws Exception + { + StringBuilder s = new StringBuilder( 1024 ); Review Comment: I will verify the code with/out the fix but I think the same as you. The unit tests are quite clear. If there is only a problem in `AbstractStreamDecoder` and nowhere else, the IT is useless. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org