@Test(expected = CowParseException.class) public void testFormatCowInvalid() throws Exception { System.out.println("formatCow"); CowFormatter.formatCow("how now brown cow", CowFace.getByMode("b"), new Message("Hello", false)); }
public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException { String result = extractCowTemplate(cow); String tongue = face.getTongue(); String eyes = face.getEyes(); String eye = StringUtils.chop(eyes); if (cow.contains("$eyes .= ($extra x 2);")) { eyes += eye; } else if (cow.contains("$eyes .= \" $other_eye\";")) { eyes = eye + " " + eye; } result = StringEscapeUtils.unescapeJava(result); result = result.replace("${tongue}", tongue); result = result.replace("$tongue", tongue); result = result.replace("$thoughts", message.getThoughts()); result = result.replace("${eyes}", eyes); result = result.replace("$eyes", eyes); result = result.replace("${eye}", eye); result = result.replace("$eye", eye); result = result.replace("${extra}", eye); result = result.replace("$extra", eye); result = result.replaceAll("EOC\\s*$", ""); result = message.getMessage() + result; return result; }
CowFormatter { public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException { String result = extractCowTemplate(cow); String tongue = face.getTongue(); String eyes = face.getEyes(); String eye = StringUtils.chop(eyes); if (cow.contains("$eyes .= ($extra x 2);")) { eyes += eye; } else if (cow.contains("$eyes .= \" $other_eye\";")) { eyes = eye + " " + eye; } result = StringEscapeUtils.unescapeJava(result); result = result.replace("${tongue}", tongue); result = result.replace("$tongue", tongue); result = result.replace("$thoughts", message.getThoughts()); result = result.replace("${eyes}", eyes); result = result.replace("$eyes", eyes); result = result.replace("${eye}", eye); result = result.replace("$eye", eye); result = result.replace("${extra}", eye); result = result.replace("$extra", eye); result = result.replaceAll("EOC\\s*$", ""); result = message.getMessage() + result; return result; } }
CowFormatter { public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException { String result = extractCowTemplate(cow); String tongue = face.getTongue(); String eyes = face.getEyes(); String eye = StringUtils.chop(eyes); if (cow.contains("$eyes .= ($extra x 2);")) { eyes += eye; } else if (cow.contains("$eyes .= \" $other_eye\";")) { eyes = eye + " " + eye; } result = StringEscapeUtils.unescapeJava(result); result = result.replace("${tongue}", tongue); result = result.replace("$tongue", tongue); result = result.replace("$thoughts", message.getThoughts()); result = result.replace("${eyes}", eyes); result = result.replace("$eyes", eyes); result = result.replace("${eye}", eye); result = result.replace("$eye", eye); result = result.replace("${extra}", eye); result = result.replace("$extra", eye); result = result.replaceAll("EOC\\s*$", ""); result = message.getMessage() + result; return result; } private  CowFormatter(); }
CowFormatter { public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException { String result = extractCowTemplate(cow); String tongue = face.getTongue(); String eyes = face.getEyes(); String eye = StringUtils.chop(eyes); if (cow.contains("$eyes .= ($extra x 2);")) { eyes += eye; } else if (cow.contains("$eyes .= \" $other_eye\";")) { eyes = eye + " " + eye; } result = StringEscapeUtils.unescapeJava(result); result = result.replace("${tongue}", tongue); result = result.replace("$tongue", tongue); result = result.replace("$thoughts", message.getThoughts()); result = result.replace("${eyes}", eyes); result = result.replace("$eyes", eyes); result = result.replace("${eye}", eye); result = result.replace("$eye", eye); result = result.replace("${extra}", eye); result = result.replace("$extra", eye); result = result.replaceAll("EOC\\s*$", ""); result = message.getMessage() + result; return result; } private  CowFormatter(); static String formatCow(final String cow, final CowFace face, final Message message); }
CowFormatter { public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException { String result = extractCowTemplate(cow); String tongue = face.getTongue(); String eyes = face.getEyes(); String eye = StringUtils.chop(eyes); if (cow.contains("$eyes .= ($extra x 2);")) { eyes += eye; } else if (cow.contains("$eyes .= \" $other_eye\";")) { eyes = eye + " " + eye; } result = StringEscapeUtils.unescapeJava(result); result = result.replace("${tongue}", tongue); result = result.replace("$tongue", tongue); result = result.replace("$thoughts", message.getThoughts()); result = result.replace("${eyes}", eyes); result = result.replace("$eyes", eyes); result = result.replace("${eye}", eye); result = result.replace("$eye", eye); result = result.replace("${extra}", eye); result = result.replace("$extra", eye); result = result.replaceAll("EOC\\s*$", ""); result = message.getMessage() + result; return result; } private  CowFormatter(); static String formatCow(final String cow, final CowFace face, final Message message);  }