Skip to content

Commit

Permalink
исправлена внесенная ошибка
Browse files Browse the repository at this point in the history
переделаны тесты
выполнен precommit
  • Loading branch information
artbear committed Nov 18, 2023
1 parent 5f18058 commit f378e30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@

)
public class ExternalAppStartingDiagnostic extends AbstractFindMethodDiagnostic {
private static final String MAIN_PATTERN_STRING =
private static final String DEFAULT_PATTERN_STRING =
"КомандаСистемы|System|ЗапуститьСистему|RunSystem|ЗапуститьПриложение|RunApp" +
"|НачатьЗапускПриложения|BeginRunningApplication" +
"|ЗапуститьПриложениеАсинх|RunAppAsync|ЗапуститьПрограмму|ОткрытьПроводник|ОткрытьФайл";
private static final String PATTERN_STRING_FOR_NAVI =
"|ПерейтиПоНавигационнойСсылке|GotoURL|ОткрытьНавигационнуюСсылку";
private static final Pattern FULL_PATTERN = CaseInsensitivePattern.compile(
MAIN_PATTERN_STRING + PATTERN_STRING_FOR_NAVI);
private static final Pattern DEFAULT_PATTERN = CaseInsensitivePattern.compile(DEFAULT_PATTERN_STRING);
private static final boolean CHECK_GOTO_URL = false;

@DiagnosticParameter(
Expand All @@ -61,12 +60,12 @@ public class ExternalAppStartingDiagnostic extends AbstractFindMethodDiagnostic

@DiagnosticParameter(
type = String.class,
defaultValue = MAIN_PATTERN_STRING
defaultValue = DEFAULT_PATTERN_STRING
)
private String userPatternString = MAIN_PATTERN_STRING;
private String userPatternString = DEFAULT_PATTERN_STRING;

public ExternalAppStartingDiagnostic() {
super(FULL_PATTERN);
super(DEFAULT_PATTERN);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@
"properties": {
"checkGotoUrl": {
"description": "Check navigation links",
"default": true,
"default": false,
"type": "boolean",
"title": "Check navigation links"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ void testConfigure_checkGotoUrl() {
.hasRange(9, 4, 23)
.hasRange(10, 4, 23)
.hasRange(12, 4, 26)
.hasRange(14, 4, 32)

.hasRange(14, 4, 32)
.hasRange(15, 26, 52)
.hasRange(16, 26, 52)
.hasRange(18, 26, 44)

.hasRange(18, 26, 44)
.hasRange(19, 26, 44)
.hasRange(20, 20, 38)
.hasRange(21, 20, 38)
Expand All @@ -105,26 +107,26 @@ void testConfigure_userPatternString() {

assertThat(diagnostics, true)
.hasRange(8, 4, 18)

.hasRange(14, 4, 32)
.hasRange(15, 26, 52)
.hasRange(16, 26, 52)

.hasSize(4);
.hasSize(1);
}

@Test
void testConfigure_userPatternString_checkGotoUrl() {

Map<String, Object> configuration = diagnosticInstance.info.getDefaultConfiguration();
configuration.put("checkGotoUrl", false);
configuration.put("checkGotoUrl", true);
configuration.put("userPatternString", "КомандаСистемы");
diagnosticInstance.configure(configuration);

List<Diagnostic> diagnostics = getDiagnostics();

assertThat(diagnostics, true)
.hasRange(8, 4, 18)
.hasSize(1);

.hasRange(14, 4, 32)
.hasRange(15, 26, 52)
.hasRange(16, 26, 52)

.hasSize(4);
}
}

0 comments on commit f378e30

Please sign in to comment.