@Test public void testBuildDelayParamFromInvalidFormat() { final MethodInfo target = index.getClassByName(DotName.createSimple(BeanWithScheduledMethods.class.getName())) .method("invalidFormatInitialDelay"); AnnotationInstance annotation = target.annotation(SpringScheduledProcessor.SPRING_SCHEDULED); try { springScheduledProcessor.buildDelayParams(annotation.values()); fail(); } catch (IllegalArgumentException expected) { } }
List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; } }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }  }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }  @BuildStep List<UnremovableBeanBuildItem> unremovableBeans(); }
SpringScheduledProcessor { List<AnnotationValue> buildDelayParams(List<AnnotationValue> springAnnotationValues) { List<AnnotationValue> confValues = new ArrayList<>(); long delay = getLongValueFromParam(springAnnotationValues, "initialDelay"); confValues.add(AnnotationValue.createLongValue("delay", delay)); confValues.add(AnnotationValue.createEnumValue("delayUnit", DotName.createSimple("java.util.concurrent.TimeUnit"), TimeUnit.MILLISECONDS.name())); return confValues; }  @BuildStep List<UnremovableBeanBuildItem> unremovableBeans();  }