package com.grinnotech.patients.mongodb;

import com.grinnotech.patients.mongodb.dao.UserRepository;
import com.grinnotech.patients.mongodb.model.User;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;


@RunWith(SpringRunner.class)
@SpringBootTest
@Ignore
public class MongoDbAutoGeneratedFieldIntegrationTest {

    @Autowired
    UserRepository userRepository;

    @Test
    public void contextLoads() {}

    @Test
    public void givenUserObject_whenSave_thenCreateNewUser() {

        User user = new User();
        user.setFirstName("John");
        user.setLastName("Doe");
        user.setEmail("john.doe@example.com");
        userRepository.save(user);

        assertThat(userRepository.findAll().size()).isGreaterThan(0);
    }


}
