Skip to content

Commit f4f7954

Browse files
committed
Additional JUnit tests
Finalized tests for ByteBufferUtils Removed old tests
1 parent 556f2da commit f4f7954

File tree

5 files changed

+108
-331
lines changed

5 files changed

+108
-331
lines changed

src/main/java/org/java_websocket/util/Charsetfunctions.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313
public class Charsetfunctions {
1414

15+
/**
16+
* Private constructor for real static class
17+
*/
18+
private Charsetfunctions() {
19+
20+
}
21+
1522
public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT;
1623

1724
/*
@@ -52,20 +59,6 @@ public static String stringUtf8( byte[] bytes ) throws InvalidDataException {
5259
return stringUtf8( ByteBuffer.wrap( bytes ) );
5360
}
5461

55-
/*public static String stringUtf8( byte[] bytes, int off, int length ) throws InvalidDataException {
56-
CharsetDecoder decode = Charset.forName( "UTF8" ).newDecoder();
57-
decode.onMalformedInput( codingErrorAction );
58-
decode.onUnmappableCharacter( codingErrorAction );
59-
//decode.replaceWith( "X" );
60-
String s;
61-
try {
62-
s = decode.decode( ByteBuffer.wrap( bytes, off, length ) ).toString();
63-
} catch ( CharacterCodingException e ) {
64-
throw new InvalidDataException( CloseFrame.NO_UTF8, e );
65-
}
66-
return s;
67-
}*/
68-
6962
public static String stringUtf8( ByteBuffer bytes ) throws InvalidDataException {
7063
CharsetDecoder decode = Charset.forName( "UTF8" ).newDecoder();
7164
decode.onMalformedInput( codingErrorAction );
@@ -82,11 +75,6 @@ public static String stringUtf8( ByteBuffer bytes ) throws InvalidDataException
8275
return s;
8376
}
8477

85-
public static void main( String[] args ) throws InvalidDataException {
86-
stringUtf8( utf8Bytes( "\0" ) );
87-
stringAscii( asciiBytes( "\0" ) );
88-
}
89-
9078
/**
9179
* Implementation of the "Flexible and Economical UTF-8 Decoder" algorithm
9280
* by Björn Höhrmann (http://bjoern.hoehrmann.de/utf-8/decoder/dfa/)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.java_websocket;
2+
3+
import org.junit.runner.RunWith;
4+
import org.junit.runners.Suite;
5+
6+
7+
@RunWith(Suite.class)
8+
@Suite.SuiteClasses({
9+
org.java_websocket.util.ByteBufferUtilsTest.class
10+
})
11+
/**
12+
* Start all tests
13+
*/
14+
public class AllTests {
15+
}

src/test/java/org/java_websocket/AutobahnClientScenario.java

Lines changed: 0 additions & 241 deletions
This file was deleted.

src/test/java/org/java_websocket/AutobahnClientTest.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)