Skip to content

Commit

Permalink
Fixed tests after merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Goszczurny committed Feb 11, 2018
1 parent e7502e6 commit 51e04aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void shouldDisplayCreateBuilderAndMemberChooserDialogAndWriteBuilderWhenO
boolean useSingleField = true;
given(createBuilderDialogFactory.createBuilderDialog(psiClassFromEditor, project, psiPackage, existingBuilder)).willReturn(createBuilderDialog);
given(createBuilderDialog.isInnerBuilder()).willReturn(isInner);
given(createBuilderDialog.useSingleField()).willReturn(useSingleField);
given(createBuilderDialog.hasButMethod()).willReturn(hasButMethod);
given(createBuilderDialog.hasFromMethod()).willReturn(hasFromMethod);
given(createBuilderDialog.isCreatePrivateConstructor()).willReturn(createPrivateConstructor);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package pl.mjedynak.idea.plugins.builder.psi;

import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.PsiParameterList;
import com.intellij.psi.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -30,6 +26,7 @@ public class ButMethodCreatorTest {
@Mock private PsiMethod method2;
@Mock private PsiMethod method3;
@Mock private PsiMethod createdMethod;
@Mock private PsiModifierList modifierList1;
@Mock private PsiParameterList parameterList1;
@Mock private PsiParameterList parameterList2;
@Mock private PsiParameter parameter;
Expand All @@ -46,7 +43,9 @@ public void mockCodeStyleManager() {
private void initOtherCommonMocks() {
given(builderClass.getMethods()).willReturn((PsiMethod[]) asList(method1, method2, method3).toArray());
given(method1.getName()).willReturn("Builder");
given(method2.getName()).willReturn("aBuilder");
given(method2.getName()).willReturn("builder");
given(method2.getModifierList()).willReturn(modifierList1);
given(modifierList1.hasExplicitModifier("static")).willReturn(true);
given(method2.getParameterList()).willReturn(parameterList1);
given(parameterList1.getParametersCount()).willReturn(0);
given(method3.getName()).willReturn("withAge");
Expand All @@ -61,7 +60,7 @@ private void initOtherCommonMocks() {
public void shouldCreateButMethod() {
// given
initOtherCommonMocks();
given(psiElementFactory.createMethodFromText("public Builder but() { return aBuilder().withAge(m_age); }", srcClass)).willReturn(createdMethod);
given(psiElementFactory.createMethodFromText("public Builder but() { return builder().withAge(m_age); }", srcClass)).willReturn(createdMethod);

// when
PsiMethod result = butMethodCreator.butMethod("Builder", builderClass, srcClass, srcClassFieldName, false);
Expand All @@ -74,7 +73,7 @@ public void shouldCreateButMethod() {
public void shouldCreateButMethodForSingleField() {
// given
initOtherCommonMocks();
given(psiElementFactory.createMethodFromText("public Builder but() { return aBuilder().withAge(className.getAge()); }", srcClass)).willReturn(createdMethod);
given(psiElementFactory.createMethodFromText("public Builder but() { return builder().withAge(className.getAge()); }", srcClass)).willReturn(createdMethod);

// when
PsiMethod result = butMethodCreator.butMethod("Builder", builderClass, srcClass, srcClassFieldName, true);
Expand Down

0 comments on commit 51e04aa

Please sign in to comment.