@Test public void testCreateFromSaveString() throws Exception { String saveString = preAndPostConditionsDescriptionSaverLoader.createSaveString(description); PreAndPostConditionsDescription recreatedPreAndPostConditionsDescription = (PreAndPostConditionsDescription) preAndPostConditionsDescriptionSaverLoader.createFromSaveString(saveString); assert (recreatedPreAndPostConditionsDescription.getName().equals("description1")); FormalPropertiesDescription recreatedPreFormalPropertiesDescription = recreatedPreAndPostConditionsDescription.getPreConditionsDescription(); assert (recreatedPreFormalPropertiesDescription.getCode(). equals("CODECODEOCDEOASD ASDAOSDASOD ;;; ;ASODAOSD")); FormalPropertiesDescription recreatedPostFormalPropertiesDescription = recreatedPreAndPostConditionsDescription.getPreConditionsDescription(); assert (recreatedPostFormalPropertiesDescription.getCode(). equals("CODECODEOCDEOASD ASDAOSDASOD ;;; ;ASODAOSD")); SymbolicVariableList recreatedList = recreatedPreAndPostConditionsDescription.getSymVarList(); assert (recreatedList.getSymbolicVariables().get(0).getId().equals("voter1")); assert (recreatedList.getSymbolicVariables().get(0).getInternalTypeContainer().getInternalType(). equals(InternalTypeRep.VOTER)); assert (recreatedList.getSymbolicVariables().get(1).getId().equals("voter2")); assert (recreatedList.getSymbolicVariables().get(1).getInternalTypeContainer().getInternalType(). equals(InternalTypeRep.VOTER)); assert (recreatedList.getSymbolicVariables().get(2).getId().equals("candidate")); assert (recreatedList.getSymbolicVariables().get(2).getInternalTypeContainer().getInternalType(). equals(InternalTypeRep.CANDIDATE)); assert (recreatedList.getSymbolicVariables().get(3).getId().equals("seat")); assert (recreatedList.getSymbolicVariables().get(3).getInternalTypeContainer().getInternalType(). equals(InternalTypeRep.SEAT)); }
@Override public Object createFromSaveString(String s) throws ArrayIndexOutOfBoundsException { Map<String, String> m = new SaverLoaderHelper().parseSaveString(s); String name = m.get("name"); String preString = m.get("pre"); FormalPropertiesDescription pre = FormalPropertySaverLoader.createFromSaveString(preString); String postString = m.get("post"); FormalPropertiesDescription post = FormalPropertySaverLoader.createFromSaveString(postString); String varlistString = m.get("varlist"); SymbolicVariableList varList = SymbolicVarListSaverLoader.createFromSaveString(varlistString); return new PreAndPostConditionsDescription(name, pre, post, varList); }
PreAndPostConditionsDescriptionSaverLoader implements SaverLoader { @Override public Object createFromSaveString(String s) throws ArrayIndexOutOfBoundsException { Map<String, String> m = new SaverLoaderHelper().parseSaveString(s); String name = m.get("name"); String preString = m.get("pre"); FormalPropertiesDescription pre = FormalPropertySaverLoader.createFromSaveString(preString); String postString = m.get("post"); FormalPropertiesDescription post = FormalPropertySaverLoader.createFromSaveString(postString); String varlistString = m.get("varlist"); SymbolicVariableList varList = SymbolicVarListSaverLoader.createFromSaveString(varlistString); return new PreAndPostConditionsDescription(name, pre, post, varList); } }
PreAndPostConditionsDescriptionSaverLoader implements SaverLoader { @Override public Object createFromSaveString(String s) throws ArrayIndexOutOfBoundsException { Map<String, String> m = new SaverLoaderHelper().parseSaveString(s); String name = m.get("name"); String preString = m.get("pre"); FormalPropertiesDescription pre = FormalPropertySaverLoader.createFromSaveString(preString); String postString = m.get("post"); FormalPropertiesDescription post = FormalPropertySaverLoader.createFromSaveString(postString); String varlistString = m.get("varlist"); SymbolicVariableList varList = SymbolicVarListSaverLoader.createFromSaveString(varlistString); return new PreAndPostConditionsDescription(name, pre, post, varList); }  }
PreAndPostConditionsDescriptionSaverLoader implements SaverLoader { @Override public Object createFromSaveString(String s) throws ArrayIndexOutOfBoundsException { Map<String, String> m = new SaverLoaderHelper().parseSaveString(s); String name = m.get("name"); String preString = m.get("pre"); FormalPropertiesDescription pre = FormalPropertySaverLoader.createFromSaveString(preString); String postString = m.get("post"); FormalPropertiesDescription post = FormalPropertySaverLoader.createFromSaveString(postString); String varlistString = m.get("varlist"); SymbolicVariableList varList = SymbolicVarListSaverLoader.createFromSaveString(varlistString); return new PreAndPostConditionsDescription(name, pre, post, varList); }  @Override String createSaveString(Object obj); @Override Object createFromSaveString(String s); }
PreAndPostConditionsDescriptionSaverLoader implements SaverLoader { @Override public Object createFromSaveString(String s) throws ArrayIndexOutOfBoundsException { Map<String, String> m = new SaverLoaderHelper().parseSaveString(s); String name = m.get("name"); String preString = m.get("pre"); FormalPropertiesDescription pre = FormalPropertySaverLoader.createFromSaveString(preString); String postString = m.get("post"); FormalPropertiesDescription post = FormalPropertySaverLoader.createFromSaveString(postString); String varlistString = m.get("varlist"); SymbolicVariableList varList = SymbolicVarListSaverLoader.createFromSaveString(varlistString); return new PreAndPostConditionsDescription(name, pre, post, varList); }  @Override String createSaveString(Object obj); @Override Object createFromSaveString(String s);  }