1
2
3
4
5 package com.lexicalscope.jewel.cli.specification;
6
7 import org.hamcrest.Description;
8 import org.hamcrest.Matcher;
9 import org.hamcrest.TypeSafeMatcher;
10
11 public class OptionSpecificationMatchers
12 {
13 public static Matcher<ParsedOptionSpecification> mandatory()
14 {
15 return new TypeSafeMatcher<ParsedOptionSpecification>(ParsedOptionSpecification.class)
16 {
17 @Override
18 public void describeTo(final Description description)
19 {
20 description.appendText("mandatory option");
21 }
22
23 @Override
24 protected boolean matchesSafely(final ParsedOptionSpecification item)
25 {
26 return !item.isOptional();
27 }
28 };
29 }
30 }