JUnit assignment on Feb 16th 2022

parent 1a14e461
package com.nisum.junit;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
public class EmployeeMockTest {
@Mock
Employee mockEmployee;
@BeforeEach
public void setUpMock(){
mockEmployee = Mockito.mock(Employee.class);
Mockito.when(mockEmployee.getFirstName()).thenReturn("Employee from Mock");
}
@Test
public void printMessageTest(){
Assertions.assertEquals("Employee from Mock", mockEmployee.getFirstName());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment