### Question:
EnumHelper { @SuppressWarnings("unchecked") public static <E extends Enum<? extends Style.HasCssName>> E fromStyleName(final String styleName, final Class<E> enumClass, final E defaultValue) { if (styleName == null || enumClass == null) { return defaultValue; } for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) { final Style.HasCssName anEnum = (Style.HasCssName) constant; final String cssClass = anEnum.getCssName(); if (cssClass != null && StyleHelper.containsStyle(styleName, cssClass)) { return (E) anEnum; } } return defaultValue; } private  EnumHelper(); @SuppressWarnings("unchecked") static E fromStyleName(final String styleName,
                                                                               final Class<E> enumClass,
                                                                               final E defaultValue);  }### Answer:
@Test public void testFromStyleName() { assertThat(fromStyleName("123 pull-left abc", Pull.class, null), is(Pull.LEFT)); assertThat(fromStyleName("123 pull-right abc", Pull.class, null), is(Pull.RIGHT)); assertThat(fromStyleName("pull-left pull-right abc", Pull.class, null), is(Pull.LEFT)); assertThat(fromStyleName("123 abc", Pull.class, null), is(nullValue())); assertThat(fromStyleName("123 abc", Pull.class, Pull.LEFT), is(Pull.LEFT)); assertThat(fromStyleName("123 abc", null, null), is(nullValue())); assertThat(fromStyleName(null, Pull.class, null), is(nullValue())); }