@Test
	public void checkCliAvailabilityIndicator() {
		GenericApplicationContext ctx = new GenericApplicationContext();
		ctx.getBeanFactory().registerSingleton("commandLine", new CommandLine(null, 100, null, false));
		XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
		reader.loadBeanDefinitions("classpath*:META-INF/spring/spring-shell-plugin.xml");
		ctx.refresh();

		Collection<CommandMarker> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(ctx, CommandMarker.class).values();
		for (Iterator<CommandMarker> it = beans.iterator(); it.hasNext();) {
			if (EXCLUDES.contains(it.next().getClass())) {
				it.remove();
			}
		}

		final MethodFilter commandMethodfilter = new AnnotationBearingMethodFilter(CliCommand.class);

		final MethodFilter availabilityMethodfilter = new AnnotationBearingMethodFilter(CliAvailabilityIndicator.class);

		for (CommandMarker plugin : beans) {
			Set<String> commandNames = new TreeSet<String>();
			Set<String> namesUsedInAvailabilityIndicator = new TreeSet<String>();
			ReflectionUtils.doWithMethods(plugin.getClass(),
					new AnnotationValueMethodCollector<CliCommand>(CliCommand.class, commandNames),
					commandMethodfilter);
			ReflectionUtils.doWithMethods(plugin.getClass(),
					new AnnotationValueMethodCollector<CliAvailabilityIndicator>(CliAvailabilityIndicator.class,
							namesUsedInAvailabilityIndicator),
							availabilityMethodfilter);

			TreeSet<String> copy = new TreeSet<String>(commandNames);
			copy.removeAll(namesUsedInAvailabilityIndicator);
			String explanation = String.format(
					"The method bearing @%s in %s is missing the following command names: %s",
					CliAvailabilityIndicator.class.getSimpleName(), plugin.getClass(), copy);
			assertTrue(explanation, namesUsedInAvailabilityIndicator.equals(commandNames));


			if (!commandNames.equals(namesUsedInAvailabilityIndicator)) {
				System.out.println(plugin);
				System.out.println(namesUsedInAvailabilityIndicator);
				System.out.println(commandNames);
				System.out.println();
			}
		}

	}
A method collector that will retrieve the (String[]) value of the {@code value()} attribute of some annotation
that methods are known to bear.
spring-xd-shell/src/test/java/org/springframework/xd/shell/util/CliAvailabilityIndicatorChecker.java