Last active
February 19, 2019 15:55
-
-
Save wkorando/3d0a65a2bdb22a948f6221d8e971cfc7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ContextConfiguration(classes = { HotelApplication.class }, initializers = ITCustomerJUnit5Repo.Initializer.class) | |
| @DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD) | |
| @TestMethodOrder(OrderAnnotation.class) | |
| public class ITCustomerJUnit5Repo { | |
| //Removed code, for clarity | |
| @Test | |
| @Order(1) | |
| public void testCountNumberOfCustomersInDB() { | |
| assertEquals(2, repo.count()); | |
| } | |
| @Test | |
| public void testRetrieveCustomerFromDatabase() { | |
| Customer customer = repo.findAll().iterator().next(); | |
| assertEquals("John", customer.getFirstName()); | |
| assertEquals("Doe", customer.getLastName()); | |
| assertEquals("Middle", customer.getMiddleName()); | |
| assertEquals("", customer.getSuffix()); | |
| } | |
| @Test | |
| public void testAddCustomerToDB() throws ParseException { | |
| Customer customer = new Customer.CustomerBuilder().firstName("BoJack").middleName("Horse").lastName("Horseman") | |
| .suffix("Sr.").build(); | |
| repo.save(customer); | |
| assertEquals(3, repo.count()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment