This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into backport_intellij_2019.2
# Conflicts: # .travis.yml # gradle.properties
- Loading branch information
Showing
8 changed files
with
206 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...st/java/de/plushnikov/intellij/plugin/extension/SneakyThrowsExceptionAddQuickFixTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.plushnikov.intellij.plugin.extension; | ||
|
||
import com.intellij.codeInsight.intention.IntentionAction; | ||
import com.intellij.openapi.editor.Editor; | ||
import com.intellij.psi.PsiFile; | ||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl; | ||
import de.plushnikov.intellij.plugin.AbstractLombokLightCodeInsightTestCase; | ||
|
||
import java.util.List; | ||
|
||
public class SneakyThrowsExceptionAddQuickFixTest extends AbstractLombokLightCodeInsightTestCase { | ||
|
||
@Override | ||
protected String getBasePath() { | ||
return super.getBasePath() + "/extension"; | ||
} | ||
|
||
public void testCheckedExeptionQuickFixExample() { | ||
myFixture.configureByFile(getBasePath() + '/' + getTestName(false) + ".java"); | ||
|
||
final List<IntentionAction> availableActions = getAvailableActions(); | ||
assertTrue("Intention to add @SneakyThrows was not presented", | ||
availableActions.stream().anyMatch(action -> action.getText().contains("@SneakyThrows"))); | ||
} | ||
|
||
protected List<IntentionAction> getAvailableActions() { | ||
final Editor editor = getEditor(); | ||
final PsiFile file = getFile(); | ||
CodeInsightTestFixtureImpl.instantiateAndRun(file, editor, new int[0], false); | ||
return CodeInsightTestFixtureImpl.getAvailableIntentions(editor, file); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
test-manual/src/main/java/de/plushnikov/findusages/Issue645.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.plushnikov.findusages; | ||
|
||
import lombok.Builder; | ||
|
||
public class Issue645 { | ||
@Builder | ||
public static class SomeDataClass { | ||
public static class SomeDataClassBuilder { | ||
private void buildWithJSON() { | ||
this.jsonObject = "test"; | ||
} | ||
} | ||
|
||
public final String jsonObject; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SomeDataClass dataClass = SomeDataClass.builder().jsonObject("sdsdsd").build(); | ||
System.out.println(dataClass.jsonObject); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
test-manual/src/main/java/de/plushnikov/sneakythrows/Issue394.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.plushnikov.sneakythrows; | ||
|
||
import lombok.SneakyThrows; | ||
|
||
import java.io.File; | ||
|
||
public class Issue394 { | ||
|
||
// @SneakyThrows | ||
public String calcString() { | ||
new File("somePath").createNewFile(); | ||
return ""; | ||
} | ||
|
||
public static void main(String[] args) { | ||
new Issue394().calcString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package extension; | ||
|
||
import java.io.IOException; | ||
|
||
public class CheckedExeptionQuickFixExample { | ||
|
||
public int calcSomething() { | ||
<caret>throw new IOException(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
System.out.println(new CheckedExeptionQuickFixExample().calcSomething()); | ||
} | ||
} |