@Test public void testSimpleEnum() { CollectionArgumentChoice<Simple> c = new CollectionArgumentChoice<Simple>(Simple.values()); assertTrue(c.contains(Simple.B)); }
@Override public boolean contains(Object val) { if (values_.isEmpty()) { return false; } Object first = values_.iterator().next(); if (first.getClass().equals(val.getClass()) || first instanceof Enum && val instanceof Enum && ((Enum) first).getDeclaringClass().equals(((Enum) val).getDeclaringClass())) { return values_.contains(val); } else { throw new IllegalArgumentException(String.format( TextHelper.LOCALE_ROOT, "type mismatch (Make sure that you specified correct Argument.type()):" + " expected: %s actual: %s", first.getClass().getName(), val.getClass().getName() )); } }
CollectionArgumentChoice implements ArgumentChoice { @Override public boolean contains(Object val) { if (values_.isEmpty()) { return false; } Object first = values_.iterator().next(); if (first.getClass().equals(val.getClass()) || first instanceof Enum && val instanceof Enum && ((Enum) first).getDeclaringClass().equals(((Enum) val).getDeclaringClass())) { return values_.contains(val); } else { throw new IllegalArgumentException(String.format( TextHelper.LOCALE_ROOT, "type mismatch (Make sure that you specified correct Argument.type()):" + " expected: %s actual: %s", first.getClass().getName(), val.getClass().getName() )); } } }
CollectionArgumentChoice implements ArgumentChoice { @Override public boolean contains(Object val) { if (values_.isEmpty()) { return false; } Object first = values_.iterator().next(); if (first.getClass().equals(val.getClass()) || first instanceof Enum && val instanceof Enum && ((Enum) first).getDeclaringClass().equals(((Enum) val).getDeclaringClass())) { return values_.contains(val); } else { throw new IllegalArgumentException(String.format( TextHelper.LOCALE_ROOT, "type mismatch (Make sure that you specified correct Argument.type()):" + " expected: %s actual: %s", first.getClass().getName(), val.getClass().getName() )); } } CollectionArgumentChoice(E... values);  CollectionArgumentChoice(Collection<E> values); }
CollectionArgumentChoice implements ArgumentChoice { @Override public boolean contains(Object val) { if (values_.isEmpty()) { return false; } Object first = values_.iterator().next(); if (first.getClass().equals(val.getClass()) || first instanceof Enum && val instanceof Enum && ((Enum) first).getDeclaringClass().equals(((Enum) val).getDeclaringClass())) { return values_.contains(val); } else { throw new IllegalArgumentException(String.format( TextHelper.LOCALE_ROOT, "type mismatch (Make sure that you specified correct Argument.type()):" + " expected: %s actual: %s", first.getClass().getName(), val.getClass().getName() )); } } CollectionArgumentChoice(E... values);  CollectionArgumentChoice(Collection<E> values); @Override boolean contains(Object val); @Override String textualFormat(); @Override String toString(); }
CollectionArgumentChoice implements ArgumentChoice { @Override public boolean contains(Object val) { if (values_.isEmpty()) { return false; } Object first = values_.iterator().next(); if (first.getClass().equals(val.getClass()) || first instanceof Enum && val instanceof Enum && ((Enum) first).getDeclaringClass().equals(((Enum) val).getDeclaringClass())) { return values_.contains(val); } else { throw new IllegalArgumentException(String.format( TextHelper.LOCALE_ROOT, "type mismatch (Make sure that you specified correct Argument.type()):" + " expected: %s actual: %s", first.getClass().getName(), val.getClass().getName() )); } } CollectionArgumentChoice(E... values);  CollectionArgumentChoice(Collection<E> values); @Override boolean contains(Object val); @Override String textualFormat(); @Override String toString();  }