package com.nonninz.robomodel.test;

import android.test.AndroidTestCase;

import com.nonninz.robomodel.RoboManager;

public class ModelTestCase extends AndroidTestCase {
    private RoboManager<TestModel> mChildManager;
    private RoboManager<ParentTestModel> mParentManager;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        mChildManager = RoboManager.get(getContext(), TestModel.class);
        mParentManager = RoboManager.get(getContext(), ParentTestModel.class);
        mChildManager.dropDatabase();
    }

    public void testWritesDifferentInstances() {
        ParentTestModel parent = mParentManager.create();
        parent.save();
        
        for (int i = 0; i < 3; i++) {
            TestModel child = mChildManager.create();
            child.save();
        }

        assertEquals(1, mParentManager.all().size());
        assertEquals(3, mChildManager.all().size());
    }

}

@@ -200,21 +200,16 @@
 Model%3E m
-Child
 Manager;
@@ -209,16 +209,16 @@
 anager;%0A
+
     priv
@@ -356,29 +356,24 @@
 ;%0A%0A        m
-Child
 Manager = Ro
@@ -506,21 +506,16 @@
        m
-Child
 Manager.
@@ -745,21 +745,16 @@
 hild = m
-Child
 Manager.
@@ -883,13 +883,8 @@
 3, m
-Child
 Mana
@@ -889,30 +889,180 @@
 nager.all().size
+());%0A    %7D%0A    %0A    public void testToJson() %7B%0A        TestModel model = mManager.create();%0A        assertEquals(String.class, model.toJson().getClass
 ());%0A    %7D%0A%0A%7D%0A

test RoboModel#toJson()