CssFile implements Serializable, Cloneable { public void toOutputStream(final OutputStream os, final String charset) throws IOException { toOutputStream(os, charset, false); }  Set<AbstractCssFileBlock> getCssBlocks(); @Override String toString(); String toCssString(); String toCssString(final boolean rebuild); void toOutputStream(final OutputStream os, final String charset); void toOutputStream(final OutputStream os, final String charsetName,
            final boolean rebuild); void toOutputStream(final OutputStream os, final boolean rebuild); void toOutputStream(final OutputStream os, final Charset charset); void toOutputStream(final OutputStream os, final Charset charset,
            final boolean rebuild); void toOutputStream(final OutputStream os); final boolean isOptimizeCssString(); void setOptimizeCssString(final boolean optimizeCssString); boolean isPrependCharset(); void setPrependCharset(final boolean prependCharset);  }
@Test public void testToOutputStream() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); final SampleCssFile sampleCssFile = new SampleCssFile(FontWeight._900); sampleCssFile.toOutputStream(baos); String cssString = new String(baos.toByteArray()); assertEquals("test-class1{font-style:normal;background-color:green;}test-class11{font-style:normal;background-color:green;}test-class2{font-style:oblique;}test-class3{font-style:oblique;}", cssString); sampleCssFile.getFontWeights().remove(FontWeight._900); baos = new ByteArrayOutputStream(); sampleCssFile.toOutputStream(baos); cssString = sampleCssFile.toCssString(); assertEquals("test-class1{font-style:normal;background-color:green;}test-class11{font-style:normal;background-color:green;}test-class2{font-style:oblique;}test-class3{font-style:oblique;}", sampleCssFile.toCssString()); }
@Test public void testToOutputStreamBooleanTrue() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); final SampleCssFile sampleCssFile = new SampleCssFile(FontWeight._900); sampleCssFile.toOutputStream(baos); String cssString = new String(baos.toByteArray()); assertEquals("test-class1{font-style:normal;background-color:green;}test-class11{font-style:normal;background-color:green;}test-class2{font-style:oblique;}test-class3{font-style:oblique;}", cssString); sampleCssFile.getFontWeights().remove(FontWeight._900); baos = new ByteArrayOutputStream(); sampleCssFile.toOutputStream(baos, true); cssString = new String(baos.toByteArray()); baos = new ByteArrayOutputStream(); sampleCssFile.toOutputStream(baos, true); cssString = new String(baos.toByteArray()); assertEquals("test-class1{font-style:normal;background-color:green;}test-class11{font-style:normal;background-color:green;}test-class2{font-style:oblique;}", cssString); }
@Test public void testToOutputStreamBooleanTrue2() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); final SampleCssFile sampleCssFile = new SampleCssFile(FontWeight.BOLDER); sampleCssFile.toOutputStream(baos); String cssString = new String(baos.toByteArray()); baos = new ByteArrayOutputStream(); sampleCssFile.toOutputStream(baos); cssString = new String(baos.toByteArray()); assertEquals("test-class1{font-style:normal;background-color:green;}test-class11{font-style:normal;background-color:green;}test-class2{font-style:oblique;}", cssString); }