@Test(expected = RuntimeException.class) public void testInvalidClickAction() throws Exception { TextParsers.XML.parse("<click action=\"bar\" value=\"ay\">foo</click>"); }
@Override public Component parse(String source) { try { source = "<span>" + source + "</span>"; JAXBContext context = JAXBContext.newInstance(Element.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Element tag = (Element) unmarshaller.unmarshal(new StringReader(source)); TextComponent.Builder builder = TextComponent.builder().content(""); tag.apply(builder); tag.loop(builder); return builder.build(); } catch (Exception e) { throw new RuntimeException("Failed to parse: " + source, e); } }
XmlParser implements TextParser { @Override public Component parse(String source) { try { source = "<span>" + source + "</span>"; JAXBContext context = JAXBContext.newInstance(Element.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Element tag = (Element) unmarshaller.unmarshal(new StringReader(source)); TextComponent.Builder builder = TextComponent.builder().content(""); tag.apply(builder); tag.loop(builder); return builder.build(); } catch (Exception e) { throw new RuntimeException("Failed to parse: " + source, e); } } }
XmlParser implements TextParser { @Override public Component parse(String source) { try { source = "<span>" + source + "</span>"; JAXBContext context = JAXBContext.newInstance(Element.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Element tag = (Element) unmarshaller.unmarshal(new StringReader(source)); TextComponent.Builder builder = TextComponent.builder().content(""); tag.apply(builder); tag.loop(builder); return builder.build(); } catch (Exception e) { throw new RuntimeException("Failed to parse: " + source, e); } }  }
XmlParser implements TextParser { @Override public Component parse(String source) { try { source = "<span>" + source + "</span>"; JAXBContext context = JAXBContext.newInstance(Element.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Element tag = (Element) unmarshaller.unmarshal(new StringReader(source)); TextComponent.Builder builder = TextComponent.builder().content(""); tag.apply(builder); tag.loop(builder); return builder.build(); } catch (Exception e) { throw new RuntimeException("Failed to parse: " + source, e); } }  @Override Component parse(String source); }
XmlParser implements TextParser { @Override public Component parse(String source) { try { source = "<span>" + source + "</span>"; JAXBContext context = JAXBContext.newInstance(Element.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Element tag = (Element) unmarshaller.unmarshal(new StringReader(source)); TextComponent.Builder builder = TextComponent.builder().content(""); tag.apply(builder); tag.loop(builder); return builder.build(); } catch (Exception e) { throw new RuntimeException("Failed to parse: " + source, e); } }  @Override Component parse(String source);  }