From 51e04aaf3542ba396eadc530ea5b2f6ee967bb6d Mon Sep 17 00:00:00 2001 From: Jakub Goszczurny Date: Sun, 11 Feb 2018 14:21:13 +0100 Subject: [PATCH] Fixed tests after merge. --- .../action/handler/DisplayChoosersTest.java | 1 + .../plugins/builder/psi/ButMethodCreatorTest.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/java/pl/mjedynak/idea/plugins/builder/action/handler/DisplayChoosersTest.java b/src/test/java/pl/mjedynak/idea/plugins/builder/action/handler/DisplayChoosersTest.java index 131d5f9..cbd9731 100644 --- a/src/test/java/pl/mjedynak/idea/plugins/builder/action/handler/DisplayChoosersTest.java +++ b/src/test/java/pl/mjedynak/idea/plugins/builder/action/handler/DisplayChoosersTest.java @@ -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); diff --git a/src/test/java/pl/mjedynak/idea/plugins/builder/psi/ButMethodCreatorTest.java b/src/test/java/pl/mjedynak/idea/plugins/builder/psi/ButMethodCreatorTest.java index e1545b2..41fa3be 100644 --- a/src/test/java/pl/mjedynak/idea/plugins/builder/psi/ButMethodCreatorTest.java +++ b/src/test/java/pl/mjedynak/idea/plugins/builder/psi/ButMethodCreatorTest.java @@ -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; @@ -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; @@ -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"); @@ -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); @@ -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);