Skip to content

Commit c5d57cb

Browse files
committed
Fixed Codestyle test failures
1 parent c308fdd commit c5d57cb

File tree

3 files changed

+64
-30
lines changed

3 files changed

+64
-30
lines changed

tests/com/magento/idea/magento2plugin/linemarker/LinemarkerFixtureTestCase.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
import com.intellij.codeInsight.daemon.LineMarkerInfo;
99
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
1010
import com.magento.idea.magento2plugin.BaseProjectTestCase;
11-
import org.jetbrains.annotations.NotNull;
12-
import javax.swing.*;
1311
import com.magento.idea.magento2plugin.magento.packages.File;
1412
import java.util.List;
13+
import javax.swing.Icon;
14+
import org.jetbrains.annotations.NotNull;
1515

16-
abstract public class LinemarkerFixtureTestCase extends BaseProjectTestCase {
16+
public abstract class LinemarkerFixtureTestCase extends BaseProjectTestCase {
1717

18-
private static final String TEST_DATA_PATH = "testData" + File.separator + "linemarker" + File.separator;
18+
private static final String TEST_DATA_PATH
19+
= "testData" + File.separator + "linemarker" + File.separator;
1920

2021
@Override
2122
protected void setUp() throws Exception {
@@ -38,19 +39,24 @@ protected void assertHasLinemarkerWithTooltipAndIcon(final String tooltip, final
3839
if (lineMarkerTooltip == null || lineMarkerIcon == null) {
3940
continue;
4041
}
41-
if (lineMarkerTooltip.equals(tooltip) &&
42-
lineMarkerIcon.toString().equals(icon)) {
42+
if (lineMarkerTooltip.equals(tooltip)
43+
&& lineMarkerIcon.toString().equals(icon)) {
4344
return;
4445
}
4546
}
4647

47-
final String lineMarkerNotFound = "Failed that documents contains linemarker with the tooltip `%s`";
48+
final String lineMarkerNotFound
49+
= "Failed that documents contains linemarker with the tooltip `%s`";
4850
fail(String.format(lineMarkerNotFound, tooltip));
4951
}
5052

51-
protected void assertHasNoLinemarkerWithTooltipAndIcon(final String tooltip, final String icon) {
53+
protected void assertHasNoLinemarkerWithTooltipAndIcon(
54+
final String tooltip,
55+
final String icon
56+
) {
5257
myFixture.doHighlighting();
53-
final String lineMarkerExist = "Failed that documents not contains linemarker with the tooltip `%s`";
58+
final String lineMarkerExist
59+
= "Failed that documents not contains linemarker with the tooltip `%s`";
5460

5561
final List<LineMarkerInfo<?>> lineMarkers = getDocumentLineMarkers();
5662
assertNotEmpty(lineMarkers);
@@ -60,15 +66,18 @@ protected void assertHasNoLinemarkerWithTooltipAndIcon(final String tooltip, fin
6066
if (lineMarkerTooltip == null || lineMarkerIcon == null) {
6167
continue;
6268
}
63-
if (lineMarkerTooltip.equals(tooltip) &&
64-
lineMarkerIcon.toString().equals(icon)) {
69+
if (lineMarkerTooltip.equals(tooltip)
70+
&& lineMarkerIcon.toString().equals(icon)) {
6571
fail(String.format(lineMarkerExist, tooltip));
6672
}
6773
}
6874
}
6975

7076
@NotNull
7177
private List<LineMarkerInfo<?>> getDocumentLineMarkers() {
72-
return DaemonCodeAnalyzerImpl.getLineMarkers(myFixture.getEditor().getDocument(), getProject());
78+
return DaemonCodeAnalyzerImpl.getLineMarkers(
79+
myFixture.getEditor().getDocument(),
80+
getProject()
81+
);
7382
}
7483
}

tests/com/magento/idea/magento2plugin/linemarker/php/ConfigurationTypeClassLinemarkerRegistrarTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@
99

1010
public class ConfigurationTypeClassLinemarkerRegistrarTest extends LinemarkerFixtureTestCase {
1111

12+
/**
13+
* Tests linemarkers in the configured class.
14+
*/
1215
public void testTypeNameClassShouldHaveLinemarker() {
1316
myFixture.configureByFile(this.getFixturePath("Topmenu.php", "php"));
1417

1518
assertHasLinemarkerWithTooltipAndIcon("Navigate to configuration", "/fileTypes/xml.svg");
1619
}
1720

21+
/**
22+
* Tests linemarkers in the non-configured class.
23+
*/
1824
public void testRegularPhpClassShouldNotHaveLinemarker() {
1925
myFixture.configureByFile(this.getFixturePath("ClassNotConfiguredInDiXml.php", "php"));
2026

tests/com/magento/idea/magento2plugin/linemarker/php/WebApiLinemarkerRegistrarTest.java

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,46 @@
1212
@SuppressWarnings("PMD.JUnitTestContainsTooManyAsserts")
1313
public class WebApiLinemarkerRegistrarTest extends LinemarkerFixtureTestCase {
1414

15-
private static final String EXPECTED_CLASS_LINE_MARKER_TOOLTIP =
16-
"Navigate to Web API configuration:<pre> PUT /V1/blog/post\n" +
17-
" POST /V1/blog/update\n" +
18-
"</pre>";
15+
private static final String EXPECTED_CLASS_LINE_MARKER_TOOLTIP
16+
= "Navigate to Web API configuration:<pre> PUT /V1/blog/post\n"
17+
+ " POST /V1/blog/update\n"
18+
+ "</pre>";
1919

20-
private static final String EXPECTED_METHOD_CREATE_LINE_MARKER_TOOLTIP =
21-
"Navigate to Web API configuration:<pre> POST /V1/blog/update\n" +
22-
"</pre>";
20+
private static final String EXPECTED_METHOD_CREATE_LINE_MARKER_TOOLTIP
21+
= "Navigate to Web API configuration:<pre> POST /V1/blog/update\n"
22+
+ "</pre>";
2323

24-
private static final String EXPECTED_METHOD_UPDATE_LINE_MARKER_TOOLTIP =
25-
"Navigate to Web API configuration:<pre> PUT /V1/blog/post\n" +
26-
"</pre>";
24+
private static final String EXPECTED_METHOD_UPDATE_LINE_MARKER_TOOLTIP
25+
= "Navigate to Web API configuration:<pre> PUT /V1/blog/post\n"
26+
+ "</pre>";
2727

2828
/**
2929
* Class configured as WEB API service in web_api.xml should have WEB API line markers.
3030
*/
3131
public void testWebApiServiceShouldHaveLinemarker() {
32-
//work around for issue caused by com.magento.idea.magento2plugin.linemarker.xml.LineMarkerXmlTagDecorator
33-
//in com.intellij.psi.impl.smartPointers.SmartPsiElementPointerImpl.createElementInfo
32+
// work around for issue caused by
33+
// com.magento.idea.magento2plugin.linemarker.xml.LineMarkerXmlTagDecorator
34+
// in com.intellij.psi.impl.smartPointers.SmartPsiElementPointerImpl.createElementInfo
3435
final boolean isInStressTestCurrent = ApplicationInfoImpl.isInStressTest();
3536
ApplicationInfoImpl.setInStressTest(true);
3637

3738
myFixture.configureByFile(this.getFixturePath("TestService.php", "php"));
3839

3940
//assert class line marker
40-
assertHasLinemarkerWithTooltipAndIcon(EXPECTED_CLASS_LINE_MARKER_TOOLTIP, MagentoIcons.WEB_API.toString());
41+
assertHasLinemarkerWithTooltipAndIcon(
42+
EXPECTED_CLASS_LINE_MARKER_TOOLTIP,
43+
MagentoIcons.WEB_API.toString()
44+
);
4145

4246
//assert methods line markers
43-
assertHasLinemarkerWithTooltipAndIcon(EXPECTED_METHOD_CREATE_LINE_MARKER_TOOLTIP, MagentoIcons.WEB_API.toString());
44-
assertHasLinemarkerWithTooltipAndIcon(EXPECTED_METHOD_UPDATE_LINE_MARKER_TOOLTIP, MagentoIcons.WEB_API.toString());
47+
assertHasLinemarkerWithTooltipAndIcon(
48+
EXPECTED_METHOD_CREATE_LINE_MARKER_TOOLTIP,
49+
MagentoIcons.WEB_API.toString()
50+
);
51+
assertHasLinemarkerWithTooltipAndIcon(
52+
EXPECTED_METHOD_UPDATE_LINE_MARKER_TOOLTIP,
53+
MagentoIcons.WEB_API.toString()
54+
);
4555

4656
//restore default value
4757
ApplicationInfoImpl.setInStressTest(isInStressTestCurrent);
@@ -54,10 +64,19 @@ public void testRegularPhpClassShouldNotHaveLinemarker() {
5464
myFixture.configureByFile(this.getFixturePath("ClassNotConfiguredInWebApiXml.php", "php"));
5565

5666
//assert class line marker
57-
assertHasNoLinemarkerWithTooltipAndIcon(EXPECTED_CLASS_LINE_MARKER_TOOLTIP, MagentoIcons.WEB_API.toString());
67+
assertHasNoLinemarkerWithTooltipAndIcon(
68+
EXPECTED_CLASS_LINE_MARKER_TOOLTIP,
69+
MagentoIcons.WEB_API.toString()
70+
);
5871

5972
//assert methods line markers
60-
assertHasNoLinemarkerWithTooltipAndIcon(EXPECTED_METHOD_CREATE_LINE_MARKER_TOOLTIP, MagentoIcons.WEB_API.toString());
61-
assertHasNoLinemarkerWithTooltipAndIcon(EXPECTED_METHOD_UPDATE_LINE_MARKER_TOOLTIP, MagentoIcons.WEB_API.toString());
73+
assertHasNoLinemarkerWithTooltipAndIcon(
74+
EXPECTED_METHOD_CREATE_LINE_MARKER_TOOLTIP,
75+
MagentoIcons.WEB_API.toString()
76+
);
77+
assertHasNoLinemarkerWithTooltipAndIcon(
78+
EXPECTED_METHOD_UPDATE_LINE_MARKER_TOOLTIP,
79+
MagentoIcons.WEB_API.toString()
80+
);
6281
}
6382
}

0 commit comments

Comments
 (0)