@Test public void extractSizeWithoutValue() { Parameters parameters = new Parameters(); int size = underTest.extractSize(parameters); assertThat(size, is(20)); }
public int extractSize(final Parameters parameters) { int size = 20; String sizeParameter = Strings.nullToEmpty(parameters.get("size")).trim(); if (!sizeParameter.isEmpty()) { try { size = Integer.parseInt(sizeParameter); } catch (NumberFormatException e) { log.debug("Invalid size encountered in search parameters {}, using default", parameters, e); } if (size < 1) { size = 1; } else if (size > 250) { size = 250; } } return size; }
NpmSearchParameterExtractor extends ComponentSupport { public int extractSize(final Parameters parameters) { int size = 20; String sizeParameter = Strings.nullToEmpty(parameters.get("size")).trim(); if (!sizeParameter.isEmpty()) { try { size = Integer.parseInt(sizeParameter); } catch (NumberFormatException e) { log.debug("Invalid size encountered in search parameters {}, using default", parameters, e); } if (size < 1) { size = 1; } else if (size > 250) { size = 250; } } return size; } }
NpmSearchParameterExtractor extends ComponentSupport { public int extractSize(final Parameters parameters) { int size = 20; String sizeParameter = Strings.nullToEmpty(parameters.get("size")).trim(); if (!sizeParameter.isEmpty()) { try { size = Integer.parseInt(sizeParameter); } catch (NumberFormatException e) { log.debug("Invalid size encountered in search parameters {}, using default", parameters, e); } if (size < 1) { size = 1; } else if (size > 250) { size = 250; } } return size; }  }
NpmSearchParameterExtractor extends ComponentSupport { public int extractSize(final Parameters parameters) { int size = 20; String sizeParameter = Strings.nullToEmpty(parameters.get("size")).trim(); if (!sizeParameter.isEmpty()) { try { size = Integer.parseInt(sizeParameter); } catch (NumberFormatException e) { log.debug("Invalid size encountered in search parameters {}, using default", parameters, e); } if (size < 1) { size = 1; } else if (size > 250) { size = 250; } } return size; }  String extractText(final Parameters parameters); int extractSize(final Parameters parameters); int extractFrom(final Parameters parameters); }
NpmSearchParameterExtractor extends ComponentSupport { public int extractSize(final Parameters parameters) { int size = 20; String sizeParameter = Strings.nullToEmpty(parameters.get("size")).trim(); if (!sizeParameter.isEmpty()) { try { size = Integer.parseInt(sizeParameter); } catch (NumberFormatException e) { log.debug("Invalid size encountered in search parameters {}, using default", parameters, e); } if (size < 1) { size = 1; } else if (size > 250) { size = 250; } } return size; }  String extractText(final Parameters parameters); int extractSize(final Parameters parameters); int extractFrom(final Parameters parameters);  }