I think I have looked everywhere. Have found some examples in Ruby but nothing coherent in Java.
How can I generate non-UTF-8 string / char in Java for testing purposes?
Specifically, I have a json
file that holds different key-values related to some translations mechanism we use (so, a lot of languages involved), this json
parsed with some mapper that we have.
I want to check if the mapper returns the proper values in case a non-UTF data encountered in the json
.
So, I would like to use it in approach like:
String expectedValue = "FooBarNonUtf8";
String actualValue = jsonReader.readFrom("file", "key"); //should parse non-UTF correctly
assertEquals(expectedValue, actualValue);