use of com.helger.commons.io.streamprovider.ByteArrayInputStreamProvider in project ph-css by phax.
the class CSSReader30SpecialFuncTest method testReadWithBOM.
@Test
public void testReadWithBOM() {
final String sCSSBase = "/* comment */.class{color:red}.class{color:blue}";
for (final EUnicodeBOM eBOM : EUnicodeBOM.values()) {
final Charset aDeterminedCharset = eBOM.getCharset();
if (aDeterminedCharset != null) {
final CascadingStyleSheet aCSS = CSSReader.readFromStream(new ByteArrayInputStreamProvider(ArrayHelper.getConcatenated(eBOM.getAllBytes(), sCSSBase.getBytes(aDeterminedCharset))), aDeterminedCharset, ECSSVersion.CSS30, new DoNothingCSSParseErrorHandler());
assertNotNull("Failed to read with BOM " + eBOM, aCSS);
assertEquals(".class{color:red}.class{color:blue}", new CSSWriter(ECSSVersion.CSS30, true).getCSSAsString(aCSS));
}
}
}
Aggregations