@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
      shouldVerifyThatFieldIsSetInSetterMethodIfItHasNoModifierListAndHasCorrectParameter() {
    // given
    given(psiClass.getAllMethods()).willReturn(methods);
    given(psiField.getName()).willReturn("field");
    given(method.getName()).willReturn("setField");
    // when
    boolean result = psiFieldVerifier.isSetInSetterMethod(psiField, psiClass);

    // then
    assertThat(result, is(true));
  }
  @Test
  public void
      shouldVerifyThatFieldIsNotSetInSetterMethodIfItIsNotPrivateButHasIncorrectParameter() {
    // given
    given(psiClass.getAllMethods()).willReturn(methods);
    given(method.getModifierList()).willReturn(modifierList);
    given(psiField.getName()).willReturn("field");
    given(method.getName()).willReturn("setAnotherField");
    // when
    boolean result = psiFieldVerifier.isSetInSetterMethod(psiField, psiClass);

    // then
    assertThat(result, is(false));
  }
  @Test
  public void shouldVerifyThatFieldIsNotSetInSetterMethodIfItIsPrivate() {
    // given
    given(psiClass.getAllMethods()).willReturn(methods);
    given(method.getModifierList()).willReturn(modifierList);
    given(psiField.getName()).willReturn("field");
    given(modifierList.hasExplicitModifier(PsiFieldVerifierImpl.PRIVATE_MODIFIER)).willReturn(true);
    given(method.getName()).willReturn("setField");
    // when
    boolean result = psiFieldVerifier.isSetInSetterMethod(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));
  }