@makasprzak answer is right but I want to add that if you want to make your tests work with TestNG without changing the variable to non-final then you can do the following:
package inject_mocks_test;
import org.mockito.Mockito;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
public class SubjectTest {
Section section;
Subject subject;
@BeforeMethod
public void setup() {
section = Mockito.mock(Section.class);
subject = new Subject(section);
}
@Test
public void test1() {
assertEquals(section, subject.getSection());
}
@Test
public void test2() {
assertEquals(section, subject.getSection());
}
}