diff --git a/.idea/runConfigurations/MockGeneratorTest.xml b/.idea/runConfigurations/MockGeneratorTest.xml index cd48c5f..9e8a816 100644 --- a/.idea/runConfigurations/MockGeneratorTest.xml +++ b/.idea/runConfigurations/MockGeneratorTest.xml @@ -1,9 +1,8 @@ - - diff --git a/Makefile b/Makefile index 9f11b57..f44930f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -APPCODE_BUILD=173.3727 +APPCODE_BUILD=181.4445 .PHONY: bootstrap downloadcommunity updateandroid updateandroidtools buildcommunity ant diff --git a/MockGenerator/MockGenerator.iml b/MockGenerator/MockGenerator.iml index ba91365..9f2d470 100644 --- a/MockGenerator/MockGenerator.iml +++ b/MockGenerator/MockGenerator.iml @@ -9,7 +9,7 @@ - + diff --git a/MockGenerator/resources/META-INF/plugin.xml b/MockGenerator/resources/META-INF/plugin.xml index 06bb143..68cb0ae 100644 --- a/MockGenerator/resources/META-INF/plugin.xml +++ b/MockGenerator/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ codes.seanhenry.mockgenerator Swift Mock Generator for AppCode - 11 + 12 Sean Henry -
  • Supports capturing of generic method parameters.
  • -
  • Supports capturing of generic method return values.
  • +
  • Fixes missing method error in AppCode 2018.1.2.
  • ]]> - + diff --git a/MockGenerator/src/codes/seanhenry/util/finder/SwiftTypeItemFinder.java b/MockGenerator/src/codes/seanhenry/util/finder/SwiftTypeItemFinder.java index ab52ce4..5723cdd 100644 --- a/MockGenerator/src/codes/seanhenry/util/finder/SwiftTypeItemFinder.java +++ b/MockGenerator/src/codes/seanhenry/util/finder/SwiftTypeItemFinder.java @@ -71,8 +71,10 @@ private List getResolvedTypes(SwiftTypeDeclaration typeDec if (inheritanceClause == null) { return Collections.emptyList(); } - List results = inheritanceClause.getReferenceTypeElementList() + List results = inheritanceClause.getTypeElementList() .stream() + .filter((e) -> e instanceof SwiftReferenceTypeElement) + .map((e) -> (SwiftReferenceTypeElement) e) .map(this::getResolvedType) .filter(Objects::nonNull) .collect(Collectors.toList()); diff --git a/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestCase.java b/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestCase.java index 8f082a0..322a9be 100644 --- a/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestCase.java +++ b/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestCase.java @@ -1,51 +1,52 @@ package codes.seanhenry.testhelpers; import com.intellij.codeInsight.intention.IntentionAction; +import com.intellij.idea.IdeaTestApplication; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; +import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; +import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl; import com.intellij.psi.PsiFile; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; -import com.intellij.testFramework.PlatformTestCase; +import com.intellij.testFramework.UsefulTestCase; import com.intellij.testFramework.fixtures.CodeInsightTestFixture; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.stream.Collectors; -public abstract class ImportProjectTestCase extends PlatformTestCase { +public abstract class ImportProjectTestCase extends UsefulTestCase { private Path testResultPath; private CodeInsightTestFixture fixture; @Override protected void tearDown() throws Exception { - try { fixture.tearDown(); - } catch (Throwable e) { - e.printStackTrace(); - } finally { fixture = null; - try { - super.tearDown(); - } catch (Throwable e) { - e.printStackTrace(); - } - } + super.tearDown(); } @Override protected void setUp() throws Exception { allowAccessToXcodeDirectory(); testResultPath = Files.createTempDirectory("codes.seanhenry.mockgenerator"); - try { - super.setUp(); - } catch (Throwable e) { - e.printStackTrace(); - } + super.setUp(); + this.initApplication(); + fixture = ImportProjectTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(getDataPath(), getProjectFileName()); + fixture.setUp(); + } + + private void initApplication() throws Exception { + IdeaTestApplication.getInstance(null); + ((PersistentFSImpl)PersistentFS.getInstance()).cleanPersistedContents(); } private void allowAccessToXcodeDirectory() throws IOException { @@ -60,13 +61,6 @@ private String findXcodePath() throws IOException { return input.lines().collect(Collectors.joining()); } - @Override - protected void setUpProject() throws Exception { - super.setUpProject(); - fixture = ImportProjectTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(getDataPath(), getProjectFileName()); - fixture.setUp(); - } - protected abstract String getDataPath(); protected abstract String getProjectFileName(); diff --git a/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestFixture.java b/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestFixture.java index a9de5b7..c9494b2 100644 --- a/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestFixture.java +++ b/MockGenerator/tests/codes/seanhenry/testhelpers/ImportProjectTestFixture.java @@ -1,11 +1,9 @@ package codes.seanhenry.testhelpers; import com.intellij.ide.impl.ProjectUtil; -import com.intellij.idea.IdeaTestApplication; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ex.ProjectManagerEx; -import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.testFramework.fixtures.IdeaProjectTestFixture; import com.intellij.testFramework.fixtures.TempDirTestFixture;