assertNoLoss("select case when p.age > 50 then 'old' when p.age > 18 then 'adult' else 'child' end from Person p where ( case when p.age > 50 then 'old' when p.age > 18 then 'adult' else 'child' end ) like ?");
assertNoLoss("/* Here we' go! */ select case when p.age > 50 then 'old' when p.age > 18 then 'adult' else 'child' end from Person p where ( case when p.age > 50 then 'old' when p.age > 18 then 'adult' else 'child' end ) like ?");
}
private void assertNoLoss(String query) {
String formattedQuery = new Formatter(query).format();
StringTokenizer formatted = new StringTokenizer(formattedQuery," \t\n\r\f()");
StringTokenizer plain = new StringTokenizer(query," \t\n\r\f()");
System.out.println("Original: " + query);
System.out.println("Formatted: " + formattedQuery);