@Test public void shouldNotVerifyThatFieldIsSetInConstructorIfConstructorHasNoParameters() { // given given(psiClass.getConstructors()).willReturn(constructors); // when boolean result = psiFieldVerifier.isSetInConstructor(psiField, psiClass); // then assertThat(result, is(false)); }
@Test public void shouldNotVerifyThatFieldIsSetInConstructorIfConstructorDoesNotExist() { // given given(psiClass.getConstructors()).willReturn(new PsiMethod[0]); // when boolean result = psiFieldVerifier.isSetInConstructor(psiField, psiClass); // then assertThat(result, is(false)); }
@Test public void shouldNotVerifyThatFieldIsSetInConstructorIfConstructorHasDifferentParameterName() { // given prepareBehaviourForReturningParameter(); given(parameter.getType()).willReturn(psiType); given(psiField.getType()).willReturn(psiType); given(parameter.getName()).willReturn(name); given(psiField.getName()).willReturn("differentName"); // when boolean result = psiFieldVerifier.isSetInConstructor(psiField, psiClass); // then assertThat(result, is(false)); }