@Ignore("Remove to run test") @Test public void soundFor35IsPlangPlongAsItHasFactors5And7() { assertEquals("PlangPlong", raindropConverter.convert(35)); }
String convert(int number) { StringBuilder result = new StringBuilder(); result.append(number % 3 == 0 ? "Pling" : ""); result.append(number % 5 == 0 ? "Plang" : ""); result.append(number % 7 == 0 ? "Plong" : ""); result = result.length() == 0 ? result.append(number) : result; return result.toString(); }
RaindropConverter { String convert(int number) { StringBuilder result = new StringBuilder(); result.append(number % 3 == 0 ? "Pling" : ""); result.append(number % 5 == 0 ? "Plang" : ""); result.append(number % 7 == 0 ? "Plong" : ""); result = result.length() == 0 ? result.append(number) : result; return result.toString(); } }
RaindropConverter { String convert(int number) { StringBuilder result = new StringBuilder(); result.append(number % 3 == 0 ? "Pling" : ""); result.append(number % 5 == 0 ? "Plang" : ""); result.append(number % 7 == 0 ? "Plong" : ""); result = result.length() == 0 ? result.append(number) : result; return result.toString(); }  }
RaindropConverter { String convert(int number) { StringBuilder result = new StringBuilder(); result.append(number % 3 == 0 ? "Pling" : ""); result.append(number % 5 == 0 ? "Plang" : ""); result.append(number % 7 == 0 ? "Plong" : ""); result = result.length() == 0 ? result.append(number) : result; return result.toString(); }   }
RaindropConverter { String convert(int number) { StringBuilder result = new StringBuilder(); result.append(number % 3 == 0 ? "Pling" : ""); result.append(number % 5 == 0 ? "Plang" : ""); result.append(number % 7 == 0 ? "Plong" : ""); result = result.length() == 0 ? result.append(number) : result; return result.toString(); }    }