// Path: source-samples/simple/src/main/java/com/samples/Person.java
// @Entity("person")
// public class Person {
// 
//   @Field("name")
//   String name;
// 
//   @Field("age")
//   int age;
// 
//   public Person() {
//   }
// 
//   public Person(String name, Integer age) {
//     this.name = name;
//     this.age = age;
//   }
// 
//   public String getName() {
//     return name;
//   }
// 
//   public Integer getAge() {
//     return age;
//   }
// }


import com.couchbase.lite.CouchbaseLiteException;
import com.couchbase.lite.Document;
import com.samples.Person;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.truth.Truth.ASSERT;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
package com.braisgabin.couchbaseliteorm;





/**
 * Created by brais on 9/1/15.
 */
@RunWith(PowerMockRunner.class)
@PrepareForTest(Document.class)
public class CouchbaseLiteOrmTest {

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void checkFactory() {
    final CouchbaseLiteOrm orm = CouchbaseLiteOrm.newInstance();

    ASSERT.that(orm).isInstanceOf(CouchbaseLiteOrmInternal.class);
  }

  @Test
  public void checkToObject_correct() {
    Document document = PowerMockito.mock(Document.class); // FIXME remove PowerMockito
    final HashMap<String, Object> properties = new HashMap<>();
    properties.put("type", "person");
    properties.put("name", "Pepe");
    properties.put("age", 23);
    when(document.getProperties()).thenReturn(properties);

    CouchbaseLiteOrm orm = new CouchbaseLiteOrmInternal();

// Path: source-samples/simple/src/main/java/com/samples/Person.java
// @Entity("person")
// public class Person {
// 
//   @Field("name")
//   String name;
// 
//   @Field("age")
//   int age;
// 
//   public Person() {
//   }
// 
//   public Person(String name, Integer age) {
//     this.name = name;
//     this.age = age;
//   }
// 
//   public String getName() {
//     return name;
//   }
// 
//   public Integer getAge() {
//     return age;
//   }
// }


// Path: core/src/test/java/com/braisgabin/couchbaseliteorm/CouchbaseLiteOrmTest.java
import com.couchbase.lite.CouchbaseLiteException;
import com.couchbase.lite.Document;
import com.samples.Person;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.truth.Truth.ASSERT;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

package com.braisgabin.couchbaseliteorm;





/**
 * Created by brais on 9/1/15.
 */
@RunWith(PowerMockRunner.class)
@PrepareForTest(Document.class)
public class CouchbaseLiteOrmTest {

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void checkFactory() {
    final CouchbaseLiteOrm orm = CouchbaseLiteOrm.newInstance();

    ASSERT.that(orm).isInstanceOf(CouchbaseLiteOrmInternal.class);
  }

  @Test
  public void checkToObject_correct() {
    Document document = PowerMockito.mock(Document.class); // FIXME remove PowerMockito
    final HashMap<String, Object> properties = new HashMap<>();
    properties.put("type", "person");
    properties.put("name", "Pepe");
    properties.put("age", 23);
    when(document.getProperties()).thenReturn(properties);

    CouchbaseLiteOrm orm = new CouchbaseLiteOrmInternal();

    Person person = orm.toObject(document);