EmailUtil { public static String getResponseSubject(IdentifiableEmailWithSubject emailWithSubject) { final String subject = emailWithSubject.getSubject(); final int length = subject.length(); if (length <= 3) { return subjectWithPrefix(subject); } final String prefix = subject.substring(0, 3); if (prefix.charAt(2) == ':' && RESPONSE_PREFIXES.contains(prefix.substring(0, 2).toLowerCase())) { return subjectWithPrefix(subject.substring(3)); } return subjectWithPrefix(subject); } private  EmailUtil(); static String getResponseSubject(IdentifiableEmailWithSubject emailWithSubject); static ReplyAddresses reply(IdentifiableEmailWithAddresses emailWithAddresses); static ReplyAddresses replyAll(IdentifiableEmailWithAddresses emailWithAddresses);  }
@Test public void firstResponseSubject() { Assert.assertEquals( "Re: Hello", EmailUtil.getResponseSubject( Email.builder() .subject("Hello") .build() ) ); }
@Test public void secondResponseSubject() { Assert.assertEquals( "Re: Hello", EmailUtil.getResponseSubject( Email.builder() .subject("RE: Hello") .build() ) ); }
@Test public void secondResponseSubjectExcessWhitespace() { Assert.assertEquals( "Re: Hello", EmailUtil.getResponseSubject( Email.builder() .subject("RE: Hello ") .build() ) ); }
@Test public void secondResponseSubjectGerman() { Assert.assertEquals( "Re: Hello", EmailUtil.getResponseSubject( Email.builder() .subject("Aw: Hello") .build() ) ); }