@Test public void shouldTruncateLongQuery() { StringBuilder longQuery = new StringBuilder(); for (int i = 0; i < 56; i++) { longQuery.append(" " + "characters15sss"); }assertThat(longQuery.length()).isGreaterThan(255); String query = testee.cleanupQuery(longQuery.toString()); assertThat(query.length()).isLessThan(255); }
@Override protected String cleanupQuery(String query) { query = super.cleanupQuery(query); if (query.length() > 255) { logger.warn("Truncating query because its length is {} but only 255 characters are supported", query.length()); StringBuilder shorterQuery = new StringBuilder(); for (String s : query.split(" ")) { if ((shorterQuery + s).length() < 255) { shorterQuery.append(" ").append(s); } else { break; } } query = shorterQuery.toString(); } return query; }
NzbsOrg extends Newznab { @Override protected String cleanupQuery(String query) { query = super.cleanupQuery(query); if (query.length() > 255) { logger.warn("Truncating query because its length is {} but only 255 characters are supported", query.length()); StringBuilder shorterQuery = new StringBuilder(); for (String s : query.split(" ")) { if ((shorterQuery + s).length() < 255) { shorterQuery.append(" ").append(s); } else { break; } } query = shorterQuery.toString(); } return query; } }
NzbsOrg extends Newznab { @Override protected String cleanupQuery(String query) { query = super.cleanupQuery(query); if (query.length() > 255) { logger.warn("Truncating query because its length is {} but only 255 characters are supported", query.length()); StringBuilder shorterQuery = new StringBuilder(); for (String s : query.split(" ")) { if ((shorterQuery + s).length() < 255) { shorterQuery.append(" ").append(s); } else { break; } } query = shorterQuery.toString(); } return query; }  }
NzbsOrg extends Newznab { @Override protected String cleanupQuery(String query) { query = super.cleanupQuery(query); if (query.length() > 255) { logger.warn("Truncating query because its length is {} but only 255 characters are supported", query.length()); StringBuilder shorterQuery = new StringBuilder(); for (String s : query.split(" ")) { if ((shorterQuery + s).length() < 255) { shorterQuery.append(" ").append(s); } else { break; } } query = shorterQuery.toString(); } return query; }   }
NzbsOrg extends Newznab { @Override protected String cleanupQuery(String query) { query = super.cleanupQuery(query); if (query.length() > 255) { logger.warn("Truncating query because its length is {} but only 255 characters are supported", query.length()); StringBuilder shorterQuery = new StringBuilder(); for (String s : query.split(" ")) { if ((shorterQuery + s).length() < 255) { shorterQuery.append(" ").append(s); } else { break; } } query = shorterQuery.toString(); } return query; }    }