Converters { public static String quoted(String q) { int qt = q.indexOf('"'); int sqt = q.indexOf("'"); if (qt == -1) { qt = Integer.MAX_VALUE; } if (sqt == -1) { sqt = Integer.MAX_VALUE; } if (qt <= sqt) { return String.format( "'%s'", q); } return String.format( "\"%s\"", q); } private  Converters(); static Node checkVar(Node n ); static Node makeLiteral(Object o); static Node makeLiteral(String value, String typeUri); static Node makeNode(Object o, PrefixMapping pMapping); static Object makeNodeOrPath(Object o, PrefixMapping pMapping); static Var makeVar(Object o); static String quoted(String q); static Collection<Node> makeValueNodes( Iterator<?> iter, PrefixMapping prefixMapping );  }
@Test public void quotedTest() { assertEquals( "'one'", Converters.quoted( "one" )); assertEquals( "\"'one'\"", Converters.quoted( "'one'" )); assertEquals( "'\"one\"'", Converters.quoted( "\"one\"" )); assertEquals( "'\"I am the 'one'\"'", Converters.quoted( "\"I am the 'one'\"" )); assertEquals( "\"'I am the \"one\"'\"", Converters.quoted( "'I am the \"one\"'" )); }