Skip to content

Instantly share code, notes, and snippets.

@safebear
Last active July 11, 2018 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save safebear/17cdd5e96c4585d862797f32dfaf4ef5 to your computer and use it in GitHub Desktop.
Save safebear/17cdd5e96c4585d862797f32dfaf4ef5 to your computer and use it in GitHub Desktop.
package com.safebear.tasklist.model;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDate;
@org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
@RunWith(SpringRunner.class)
public class DataJpaTest {
@Autowired
private TestEntityManager tem;
@Test
public void mapping(){
LocalDate localDate = LocalDate.now();
Task task = this.tem.persistFlushFind(new Task(null, "Mop the floors", localDate, false));
Assertions.assertThat(task.getId()).isNotNull();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment