/** Serialize a stylesheet to a String */ public String serialize(List<Object> styleSheet) { StringWriter writer = new StringWriter(); serialize(styleSheet, writer); return writer.toString(); }
/** Serialize a stylesheet to a String */ public String serialize(List<Object> styleSheet) { StringWriter writer = new StringWriter(); serialize(styleSheet, writer); return writer.toString(); }
/** Serialize a stylesheet to a String */ public String serialize(List<Object> styleSheet) { StringWriter writer = new StringWriter(); serialize(styleSheet, writer); return writer.toString(); }
@Test public void testClone() throws Exception { // Set the cache so we force cloning cajaCssParser.setCacheProvider(new LruCacheProvider(100)); // Compare the raw parsed structure to a cloned one List<Object> styleSheet = cajaCssParser.parseImpl(CSS); List<Object> styleSheet2 = cajaCssParser.parse(CSS); assertEquals(cajaCssParser.serialize(styleSheet), cajaCssParser.serialize(styleSheet2)); }
@Test public void testClone() throws Exception { // Set the cache so we force cloning cajaCssParser.setCacheProvider(new LruCacheProvider(100)); // Compare the raw parsed structure to a cloned one List<Object> styleSheet = cajaCssParser.parseImpl(CSS); List<Object> styleSheet2 = cajaCssParser.parse(CSS); assertEquals(cajaCssParser.serialize(styleSheet), cajaCssParser.serialize(styleSheet2)); }
@Test public void testCache() throws Exception { cajaCssParser.setCacheProvider(new LruCacheProvider(100)); // Ensure that we return cloned instances and not the original out of the cache. Cloned // instances intentionally do not compare equal but should produce the same output List<Object> styleSheet = cajaCssParser.parse(CSS); List<Object> styleSheet2 = cajaCssParser.parse(CSS); assertFalse(styleSheet.equals(styleSheet2)); assertEquals(cajaCssParser.serialize(styleSheet), cajaCssParser.serialize(styleSheet2)); } }
@Test public void testBasicCssParse() throws Exception { String css = ".xyz { font : bold; } A { color : #7f7f7f }"; List<Object> styleSheet = cajaCssParser.parse(css); assertEquals(cajaCssParser.serialize(styleSheet), css); }
@Test public void testCache() throws Exception { cajaCssParser.setCacheProvider(new LruCacheProvider(100)); // Ensure that we return cloned instances and not the original out of the cache. Cloned // instances intentionally do not compare equal but should produce the same output List<Object> styleSheet = cajaCssParser.parse(CSS); List<Object> styleSheet2 = cajaCssParser.parse(CSS); assertFalse(styleSheet.equals(styleSheet2)); assertEquals(cajaCssParser.serialize(styleSheet), cajaCssParser.serialize(styleSheet2)); } }
@Test public void testBasicCssParse() throws Exception { String css = ".xyz { font : bold; } A { color : #7f7f7f }"; List<Object> styleSheet = cajaCssParser.parse(css); assertEquals(cajaCssParser.serialize(styleSheet), css); }
@Test public void testBasicCssParse() throws Exception { String css = ".xyz { font : bold; } A { color : #7f7f7f }"; List<Object> styleSheet = cajaCssParser.parse(css); assertEquals(cajaCssParser.serialize(styleSheet), css); }
@Test public void testClone() throws Exception { // Set the cache so we force cloning cajaCssParser.setCacheProvider(new LruCacheProvider(100)); // Compare the raw parsed structure to a cloned one List<Object> styleSheet = cajaCssParser.parseImpl(CSS); List<Object> styleSheet2 = cajaCssParser.parse(CSS); assertEquals(cajaCssParser.serialize(styleSheet), cajaCssParser.serialize(styleSheet2)); }
@Test public void testCache() throws Exception { cajaCssParser.setCacheProvider(new LruCacheProvider(100)); // Ensure that we return cloned instances and not the original out of the cache. Cloned // instances intentionally do not compare equal but should produce the same output List<Object> styleSheet = cajaCssParser.parse(CSS); List<Object> styleSheet2 = cajaCssParser.parse(CSS); assertFalse(styleSheet.equals(styleSheet2)); assertEquals(cajaCssParser.serialize(styleSheet), cajaCssParser.serialize(styleSheet2)); } }