EntitlerJob implements AsyncJob { public static EntitlerJobConfig createConfig(int limit) { return new EntitlerJobConfig(limit); } @Inject  EntitlerJob(final Entitler e, final PoolCurator p, final I18n i18n); @Override void execute(final JobExecutionContext context); static EntitlerJobConfig createConfig(int limit); static final String JOB_KEY; static final String JOB_NAME; static final String CFG_JOB_THROTTLE; static final int DEFAULT_THROTTLE; }
@Test void allArgsOk() { final JobConfig config = EntitlerJob.createConfig(LIMIT) .setOwner(owner) .setConsumer(consumer) .setPoolQuantity(POOL_ID, 1); assertDoesNotThrow(config::validate); }
@Test void consumerMustBePresent() { final JobConfig config = EntitlerJob.createConfig(LIMIT) .setOwner(owner) .setPoolQuantity(POOL_ID, 1); assertThrows(JobConfigValidationException.class, config::validate); }
@Test void consumerCannotBeBlank() { consumer.setUuid(""); final JobConfig config = EntitlerJob.createConfig(LIMIT) .setOwner(owner) .setConsumer(consumer) .setPoolQuantity(POOL_ID, 1); assertThrows(JobConfigValidationException.class, config::validate); }
@Test void poolQuantitiesMustBePresent() { final JobConfig config = EntitlerJob.createConfig(LIMIT) .setOwner(owner) .setConsumer(consumer); assertThrows(JobConfigValidationException.class, config::validate); }
@Test void poolQuantityIdCannotBeBlank() { assertThrows(IllegalArgumentException.class, () -> EntitlerJob.createConfig(LIMIT).setPoolQuantity("", 1)); }
@Test void poolQuantitiesCannotNegative() { assertThrows(IllegalArgumentException.class, () -> EntitlerJob.createConfig(LIMIT).setPoolQuantity(POOL_ID, -1)); }