@Test public void bad_format_key_value_pair() { String input = "abraxas"; try { TapestryInternalUtils.parseKeyValue(input); unreachable(); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "Key/value pair 'abraxas' is not properly formatted (it does not contain an equals sign)."); } }
public static KeyValue parseKeyValue(String input) { int pos = input.indexOf('='); if (pos < 1) throw new IllegalArgumentException(String.format("Key/value pair '%s' is not properly formatted (it does not contain an equals sign).", input)); String key = input.substring(0, pos); String value = input.substring(pos + 1); return new KeyValue(key.trim(), value.trim()); }
TapestryInternalUtils { public static KeyValue parseKeyValue(String input) { int pos = input.indexOf('='); if (pos < 1) throw new IllegalArgumentException(String.format("Key/value pair '%s' is not properly formatted (it does not contain an equals sign).", input)); String key = input.substring(0, pos); String value = input.substring(pos + 1); return new KeyValue(key.trim(), value.trim()); } }
TapestryInternalUtils { public static KeyValue parseKeyValue(String input) { int pos = input.indexOf('='); if (pos < 1) throw new IllegalArgumentException(String.format("Key/value pair '%s' is not properly formatted (it does not contain an equals sign).", input)); String key = input.substring(0, pos); String value = input.substring(pos + 1); return new KeyValue(key.trim(), value.trim()); }  }
TapestryInternalUtils { public static KeyValue parseKeyValue(String input) { int pos = input.indexOf('='); if (pos < 1) throw new IllegalArgumentException(String.format("Key/value pair '%s' is not properly formatted (it does not contain an equals sign).", input)); String key = input.substring(0, pos); String value = input.substring(pos + 1); return new KeyValue(key.trim(), value.trim()); }  static String toUserPresentable(String id); static Map<String, String> mapFromKeysAndValues(String... keysAndValues); static OptionModel toOptionModel(String input); static List<OptionModel> toOptionModels(String input); static SelectModel toSelectModel(String input); static OptionModel toOptionModel(Map.Entry input); static List<OptionModel> toOptionModels(Map<K, V> input); static SelectModel toSelectModel(Map<K, V> input); static OptionModel toOptionModel(Object input); static List<OptionModel> toOptionModels(List<E> input); static SelectModel toSelectModel(List<E> input); static KeyValue parseKeyValue(String input); static String extractIdFromPropertyExpression(String expression); static String defaultLabel(String id, Messages messages, String propertyExpression); static String lastTerm(String input); static String toClassAttributeValue(List<String> classes); static String getLabelForEnum(Messages messages, String prefix, Enum value); static String getLabelForEnum(Messages messages, Enum value); static boolean isEqual(T left, T right); static String[] splitPath(String path); static String[] splitAtCommas(String value); static void copy(InputStream in, OutputStream out); static boolean isEqual(EventContext left, EventContext right); static Asset2 toAsset2(final Asset asset); static InternalPropertyConduit toInternalPropertyConduit(final PropertyConduit conduit); static Orderable<String> mixinTypeAndOrder(String mixinDef); static String[] splitMixinConstraints(String s); static LinkCreationListener2 toLinkCreationListener2(final LinkCreationListener delegate); static String toFileSuffix(String fileName); static V getAndDeref(Map<K, ? extends Reference<V>> map, K key); static Thread[] getAllThreads(); }
TapestryInternalUtils { public static KeyValue parseKeyValue(String input) { int pos = input.indexOf('='); if (pos < 1) throw new IllegalArgumentException(String.format("Key/value pair '%s' is not properly formatted (it does not contain an equals sign).", input)); String key = input.substring(0, pos); String value = input.substring(pos + 1); return new KeyValue(key.trim(), value.trim()); }  static String toUserPresentable(String id); static Map<String, String> mapFromKeysAndValues(String... keysAndValues); static OptionModel toOptionModel(String input); static List<OptionModel> toOptionModels(String input); static SelectModel toSelectModel(String input); static OptionModel toOptionModel(Map.Entry input); static List<OptionModel> toOptionModels(Map<K, V> input); static SelectModel toSelectModel(Map<K, V> input); static OptionModel toOptionModel(Object input); static List<OptionModel> toOptionModels(List<E> input); static SelectModel toSelectModel(List<E> input); static KeyValue parseKeyValue(String input); static String extractIdFromPropertyExpression(String expression); static String defaultLabel(String id, Messages messages, String propertyExpression); static String lastTerm(String input); static String toClassAttributeValue(List<String> classes); static String getLabelForEnum(Messages messages, String prefix, Enum value); static String getLabelForEnum(Messages messages, Enum value); static boolean isEqual(T left, T right); static String[] splitPath(String path); static String[] splitAtCommas(String value); static void copy(InputStream in, OutputStream out); static boolean isEqual(EventContext left, EventContext right); static Asset2 toAsset2(final Asset asset); static InternalPropertyConduit toInternalPropertyConduit(final PropertyConduit conduit); static Orderable<String> mixinTypeAndOrder(String mixinDef); static String[] splitMixinConstraints(String s); static LinkCreationListener2 toLinkCreationListener2(final LinkCreationListener delegate); static String toFileSuffix(String fileName); static V getAndDeref(Map<K, ? extends Reference<V>> map, K key); static Thread[] getAllThreads(); static Mapper<Asset, StylesheetLink> assetToStylesheetLink; }