protected void doTestIntention(String testName, String hint) throws Throwable { myFixture.configureByFile(testName + "/before.csv"); final IntentionAction action = myFixture.filterAvailableIntentions(hint).stream() .filter(intentionAction -> intentionAction.getText().equals(hint)) .findFirst().get(); myFixture.launchAction(action); myFixture.checkResultByFile(testName + "/after.csv"); }
protected void doTestIntention(String testName, String hint) throws Throwable { myFixture.configureByFile(testName + "/before.tsv"); final IntentionAction action = myFixture.filterAvailableIntentions(hint).stream() .filter(intentionAction -> intentionAction.getText().equals(hint)) .findFirst().get(); myFixture.launchAction(action); myFixture.checkResultByFile(testName + "/after.tsv"); }
protected void doTestIntention(String testName, String hint) throws Throwable { myFixture.configureByFile(testName + "/before.csv"); final IntentionAction action = myFixture.filterAvailableIntentions(hint).stream() .filter(intentionAction -> intentionAction.getText().equals(hint)) .findFirst().get(); myFixture.launchAction(action); myFixture.checkResultByFile(testName + "/after.csv"); }
public void testWrongUsageOfMappersFactory() { doTest(); String testName = getTestName( false ); List<IntentionAction> allQuickFixes = myFixture.getAllQuickFixes(); assertThat( allQuickFixes ) .extracting( IntentionAction::getText ) .as( "Intent Text" ) .containsExactly( "Annotate interface 'NotMapStructMapper' as @Mapper", "Remove usage of Mappers factory", "Annotate interface 'NotMapStructMapper2' as @Mapper", "Remove usage of Mappers factory", "Remove 'spring' componentModel from 'SpringComponentModelMapper' @Mapper", "Remove usage of Mappers factory", "Remove 'jsr330' componentModel from 'Jsr330ComponentModelMapper' @Mapper", "Remove usage of Mappers factory", "Remove 'custom' componentModel from 'CustomComponentModelMapper' @Mapper", "Remove usage of Mappers factory" ); myFixture.launchAction( allQuickFixes.get( 1 ) ); // Remove usage of Mappers factory myFixture.launchAction( allQuickFixes.get( 2 ) ); // Annotate NotMapStructMapper2 myFixture.launchAction( allQuickFixes.get( 5 ) ); // Remove usage of Mappers factory myFixture.launchAction( allQuickFixes.get( 6 ) ); // Remove jsr330 componentModel myFixture.launchAction( allQuickFixes.get( 8 ) ); // Remove custom componentModel myFixture.checkResultByFile( testName + "_after.java" ); } }
public void testMissingMapperOrConfigIntent() { doTest(); List<IntentionAction> allQuickFixes = myFixture.getAllQuickFixes(); assertThat( allQuickFixes ).extracting( IntentionAction::getText ) .containsExactly( "Annotate interface 'InterfaceWithMappingAnnotations' as @Mapper", "Annotate interface 'InterfaceWithMappingAnnotations' as @MapperConfig", "Annotate class 'ClassWithMappingAnnotations' as @Mapper", "Annotate class 'ClassWithMappingAnnotations' as @MapperConfig" ); myFixture.launchAction( allQuickFixes.get( 1 ) ); myFixture.launchAction( allQuickFixes.get( 2 ) ); myFixture.checkResultByFile( getTestName( false ) + "_after.java" ); } }
private void doTestIntentionWithoutLoad(@NotNull String intentionPrefix, boolean checkErrors) { myFixture.launchAction(getSingleIntention(intentionPrefix)); if (checkErrors) { assertNoErrorElements(); } UsefulTestCase.assertSameLinesWithFile(getTestResultsFilePath(), getFile().getText()); }