package com.github.davidmoten.rx;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;

import rx.Observable;

public class SerializedTest {

    @Test
    public void testSerializeAndDeserialize() {
        File file = new File("target/temp123");
        file.delete();
        Observable<Integer> source = Observable.just(1, 2, 3);
        Serialized.write(source, file, false).subscribe();
        assertTrue(file.exists());
        assertTrue(file.length()>0);
        List<Integer> list = Serialized.<Integer> read(file).toList().toBlocking().single();
        assertEquals(Arrays.asList(1,2,3),list);
    }

}

@@ -318,16 +318,32 @@
 erialize
+OfNonEmptyStream
 () %7B%0A   
@@ -385,10 +385,8 @@
 emp1
-23
 %22);%0A
@@ -691,24 +691,24 @@
 ).single();%0A
-
         asse
@@ -749,12 +749,443 @@
 );%0A    %7D
+%0A    %0A    @Test%0A    public void testSerializeAndDeserializeOfEmptyStream() %7B%0A        File file = new File(%22target/temp2%22);%0A        file.delete();%0A        Observable%3CInteger%3E source = Observable.empty();%0A        Serialized.write(source, file, false).subscribe();%0A        assertTrue(file.exists());%0A        List%3CInteger%3E list = Serialized.%3CInteger%3E read(file).toList().toBlocking().single();%0A        assertTrue(list.isEmpty());%0A    %7D
 %0A%0A%7D%0A

add another test for Serialized utility class