public static PluginDefinition forPlugin(Class<? extends TsunamiPlugin> pluginClazz) {
    Optional<PluginInfo> pluginInfo =
        Optional.ofNullable(pluginClazz.getAnnotation(PluginInfo.class));
    Optional<ForServiceName> targetServiceName =
        Optional.ofNullable(pluginClazz.getAnnotation(ForServiceName.class));
    Optional<ForSoftware> targetSoftware =
        Optional.ofNullable(pluginClazz.getAnnotation(ForSoftware.class));
    boolean isForWebService = pluginClazz.isAnnotationPresent(ForWebService.class);
    Optional<ForOperatingSystemClass> targetOperatingSystemClass =
        Optional.ofNullable(pluginClazz.getAnnotation(ForOperatingSystemClass.class));

    checkState(
        pluginInfo.isPresent(),
        "A @PluginInfo annotation is required when creating a PluginDefinition for plugin: %s",
        pluginClazz);

    return new AutoValue_PluginDefinition(
        pluginInfo.get(),
        targetServiceName,
        targetSoftware,
        isForWebService,
        targetOperatingSystemClass);
  }
@Test
  public void forPlugin_whenPluginHasNoAnnotation_throwsException() {
    assertThrows(
        IllegalStateException.class, () -> PluginDefinition.forPlugin(NoAnnotationPlugin.class));
  }