- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {ScheduledThreadPoolExecutor s =
new ScheduledThreadPoolExecutor(corePoolSize)
ThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
String str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
- Smart code suggestions by Codota
}
/** * Validate the item and return it unmodified * * @return the input item * @throws ValidationException if validation fails */ @Override public T process(T item) throws ValidationException { try { validator.validate(item); } catch (ValidationException e) { if (filter) { return null; // filter the item } else { throw e; // skip the item } } return item; }
private String processFailedValidation(ValidatingItemProcessor<String> tested) { validator.validate(ITEM); when(validator).thenThrow(new ValidationException("invalid item")); return tested.process(ITEM); } }
@Test public void testSuccessfulValidation() throws Exception { ValidatingItemProcessor<String> tested = new ValidatingItemProcessor<>(validator); validator.validate(ITEM); assertSame(ITEM, tested.process(ITEM)); }
/** * Validate the item and return it unmodified * * @return the input item * @throws ValidationException if validation fails */ @Override public T process(T item) throws ValidationException { try { validator.validate(item); } catch (ValidationException e) { if (filter) { return null; // filter the item } else { throw e; // skip the item } } return item; }