package com.nisum.junit; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvFileSource; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumingThat; public class EmployeeTest { private Employee employee; @BeforeEach public void beforeEachTest() { employee = new Employee(); } //Csv File source //AssertAll @ParameterizedTest @CsvFileSource(resources = "/employees-list.csv", numLinesToSkip = 1) public void parameterizedCsvFileTest(String firstName, String lastName, int age, String addressLine1, String addressLine2, String city, String state, String postalCode) { employee = employee.addEmployee(firstName, lastName, age, addressLine1, addressLine2, city, state, postalCode); Assertions.assertAll( () -> Assertions.assertNotNull(employee.getFirstName()), () -> Assertions.assertNotNull(employee.getLastName()), () -> Assertions.assertNotNull(employee.getAge()), () -> Assertions.assertNotNull(employee.getAddressLine1()), () -> Assertions.assertNotNull(employee.getAddressLine2()), () -> Assertions.assertNotNull(employee.getCity()), () -> Assertions.assertNotNull(employee.getState()), () -> Assertions.assertNotNull(employee.getPostalCode()) ); } //Assumptions @Test public void assumingThatEmployeeTest(){ Employee employee = new Employee(); assumingThat(employee == null, () -> assertTrue(employee.getFirstName()!=null, "assumingThatTest - Failed")); assertFalse(employee.getFirstName()!=null, "assumingThatTest - Failed"); } }