@Test void deserializeShouldThrowWhenNull() { assertThatThrownBy(() -> Group.deserialize(null)) .isInstanceOf(Group.GroupDeserializationException.class); }
public static Group deserialize(String serializedGroup) throws GroupDeserializationException { try { Preconditions.checkNotNull(serializedGroup, "A serialized group can not be null"); Preconditions.checkArgument(!Strings.isNullOrEmpty(serializedGroup), "A serialized group can not be empty"); if (serializedGroup.startsWith(GenericGroup.class.getName() + GenericGroup.DELIMITER)) { return new GenericGroup(serializedGroup.substring(GenericGroup.class.getName().length() + 1)); } Class<?> groupClass = Class.forName(serializedGroup); return instantiateGroup(groupClass); } catch (Exception e) { throw new GroupDeserializationException(e); } }
Group { public static Group deserialize(String serializedGroup) throws GroupDeserializationException { try { Preconditions.checkNotNull(serializedGroup, "A serialized group can not be null"); Preconditions.checkArgument(!Strings.isNullOrEmpty(serializedGroup), "A serialized group can not be empty"); if (serializedGroup.startsWith(GenericGroup.class.getName() + GenericGroup.DELIMITER)) { return new GenericGroup(serializedGroup.substring(GenericGroup.class.getName().length() + 1)); } Class<?> groupClass = Class.forName(serializedGroup); return instantiateGroup(groupClass); } catch (Exception e) { throw new GroupDeserializationException(e); } } }
Group { public static Group deserialize(String serializedGroup) throws GroupDeserializationException { try { Preconditions.checkNotNull(serializedGroup, "A serialized group can not be null"); Preconditions.checkArgument(!Strings.isNullOrEmpty(serializedGroup), "A serialized group can not be empty"); if (serializedGroup.startsWith(GenericGroup.class.getName() + GenericGroup.DELIMITER)) { return new GenericGroup(serializedGroup.substring(GenericGroup.class.getName().length() + 1)); } Class<?> groupClass = Class.forName(serializedGroup); return instantiateGroup(groupClass); } catch (Exception e) { throw new GroupDeserializationException(e); } }  }
Group { public static Group deserialize(String serializedGroup) throws GroupDeserializationException { try { Preconditions.checkNotNull(serializedGroup, "A serialized group can not be null"); Preconditions.checkArgument(!Strings.isNullOrEmpty(serializedGroup), "A serialized group can not be empty"); if (serializedGroup.startsWith(GenericGroup.class.getName() + GenericGroup.DELIMITER)) { return new GenericGroup(serializedGroup.substring(GenericGroup.class.getName().length() + 1)); } Class<?> groupClass = Class.forName(serializedGroup); return instantiateGroup(groupClass); } catch (Exception e) { throw new GroupDeserializationException(e); } }  static Group deserialize(String serializedGroup); String asString(); @Override boolean equals(Object o); @Override int hashCode(); }
Group { public static Group deserialize(String serializedGroup) throws GroupDeserializationException { try { Preconditions.checkNotNull(serializedGroup, "A serialized group can not be null"); Preconditions.checkArgument(!Strings.isNullOrEmpty(serializedGroup), "A serialized group can not be empty"); if (serializedGroup.startsWith(GenericGroup.class.getName() + GenericGroup.DELIMITER)) { return new GenericGroup(serializedGroup.substring(GenericGroup.class.getName().length() + 1)); } Class<?> groupClass = Class.forName(serializedGroup); return instantiateGroup(groupClass); } catch (Exception e) { throw new GroupDeserializationException(e); } }  static Group deserialize(String serializedGroup); String asString(); @Override boolean equals(Object o); @Override int hashCode();  }