### Question:
FieldComponent { public final boolean hasOption(String optionName) { if (formField == null || formField.options() == null) { return false; } else { return Stream.of(formField.options()) .filter(s -> s.equalsIgnoreCase(optionName) || s.startsWith(optionName + "=")) .findFirst().isPresent(); } }  final void setup(String name, AccessibleObject fieldOrMethod, FormField field, SlingScriptHelper sling); abstract void init(); final void setHelper(SlingScriptHelper helper); final SlingScriptHelper getHelper(); final void setPath(String path); final String getPath(); @Deprecated final Field getField(); final AccessibleObject getAccessibleObject(); final FormField getFieldDefinition(); final String getHtml(); Resource buildComponentResource(); final ResourceMetadata getComponentMetadata(); final Map<ClientLibraryType, Set<String>> getClientLibraryCategories(); final void addClientLibrary(String category); final void addClientLibraries(ClientLibraryType type, String... categories); final void addClientLibraries(ClientLibraryType type, Collection<String> categories); final void addClientLibraries(FieldComponent component); final String getResourceType(); final void setResourceType(String resourceType); final String getResourceSuperType(); final void setResourceSuperType(String resourceSuperType); final void purgeEmptyMetadata(); final String getName(); final Collection<String> getOptionNames(); final boolean hasOption(String optionName); final Optional<String> getOption(String option); final Optional<Boolean> getBooleanOption(String option); final String getCategory(); final void setCategory(String category);  }### Answer:
@Test public void hasOption() { FieldComponent testComponent = new TestFieldComponent(new String[]{"a=b", "c", "d="}); assertTrue(testComponent.hasOption("a")); assertTrue(testComponent.hasOption("c")); assertTrue(testComponent.hasOption("d")); assertFalse(testComponent.hasOption("z")); }
@Test public void hasOptionNullOptions() { FieldComponent testComponent = new TestFieldComponent(null); assertFalse(testComponent.hasOption("z")); }