### Question:
MethodNameParser { public static MethodNameInfo parse(String str) { OrderUnit ou = parseOrderUnit(str); if (ou != null) { str = str.substring(0, str.length() - ou.getOrderStrSize()); } List<OpUnit> opUnits = new ArrayList<OpUnit>(); List<String> logics = new ArrayList<String>(); Pattern p = Pattern.compile(LOGIC_REGEX); Matcher m = p.matcher(str); int index = 0; while (m.find()) { opUnits.add(OpUnit.create(str.substring(index, m.start()))); logics.add(Strings.firstLetterToLowerCase(m.group())); index = m.end(); } opUnits.add(OpUnit.create(str.substring(index))); return new MethodNameInfo(opUnits, logics, ou); }  static MethodNameInfo parse(String str);  }### Answer:
@Test public void parse() throws Exception { MethodNameInfo info = MethodNameParser.parse("EmailAddressAndLastnameLessThanOrIdOrderByUserIdDesc"); assertThat(info.getLogics(), equalTo(Arrays.asList("and", "or"))); OrderUnit ou = info.getOrderUnit(); assertThat(ou.getOrderType(), equalTo(OrderType.DESC)); assertThat(ou.getProperty(), equalTo("userId")); assertThat(ou.getOrderStrSize(), equalTo(17)); List<OpUnit> ous = info.getOpUnits(); assertThat(ous.size(), equalTo(3)); assertThat(ous.get(0).getOp(), equalTo((Op) new EqualsOp())); assertThat(ous.get(0).getProperty(), equalTo("emailAddress")); assertThat(ous.get(1).getOp(), equalTo((Op) new LessThanOp())); assertThat(ous.get(1).getProperty(), equalTo("lastname")); assertThat(ous.get(2).getOp(), equalTo((Op) new EqualsOp())); assertThat(ous.get(2).getProperty(), equalTo("id")); }