@SuppressWarnings("unchecked")
    public static <T extends Savable> T saveAndLoad(AssetManager assetManager, T object) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            BinaryExporter exporter = new BinaryExporter();
            exporter.save(object, baos);
            BinaryImporter importer = new BinaryImporter();
            importer.setAssetManager(assetManager);
            return (T) importer.load(baos.toByteArray());
        } catch (IOException ex) {
            // Should never happen.
            throw new AssertionError(ex);
        }
    }
Saves the object into memory then loads it from memory.

Used by tests to check if the persistence system is working.

@param <T> The type of savable.
@param assetManager AssetManager to load assets from.
@param object The object to save and then load.
@return A new instance that has been saved and loaded from the
original object.
jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java