-
Notifications
You must be signed in to change notification settings - Fork 86
#285 Исправлена ошибка в проверяющем тесте в уроке Неизменяемость строк #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
fc4786c
5afbd56
a286979
10418ef
52cea5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| public class App { | ||
| public static void main(String[] args) { | ||
| var email = " SupporT@hexlet.io\n"; | ||
|
|
||
| public static final String email = " SupporT@hexlet.io\n"; | ||
|
|
||
| public static String normalize() { | ||
| // BEGIN | ||
| email = email.trim(); | ||
| email = email.toLowerCase(); | ||
| System.out.println(email); | ||
| return email.trim().toLowerCase(); | ||
| // END | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,11 @@ | |
| * Удаление концевых пробельных символов с помощью метода `.trim()`, например, было: `" hexlet\n "`, стало: `"hexlet"` | ||
| * Приведение к нижнему регистру с помощью метода `toLowerCase()`. Было: `"SUPPORT@hexlet.io"`, стало: `"support@hexlet.io"`. | ||
|
|
||
| Обновите переменную `email` записав в неё то же самое значение, но обработанное по схеме указанной выше. Распечатайте то, что получилось, на экран. | ||
| Напишите метод `normalize()` | ||
| ``` | ||
| public static final String email = " SupporT@hexlet.io\n"; | ||
| public static String normalize() { | ||
| ... | ||
| } | ||
| ``` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Здесь осталось про метод normalize
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вернул обратно как было. Да, теперь получается нет разницы с тем, что было раньше, за исключением теста. Причина бага как раз в нем |
||
| который для заданного значения `email` вернет его же, но обработанное по схеме указанной выше. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
емнип на данном этапе студенты не работали со свойствами. Поэтому давайте оставим все внутри одного метода, с переменной. Да и создание своих методов рассмаривается дальше (поэтому мы тут и печатаем на экран).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хорошо. Будем печатать. Печать добавляет перевод строки, который мы здесь, как и в других тестах, удаляем с помощью actual.trim() Но это слишком сильно, так как удаляет не только последний символ. Из за этого получился данный баг. Теперь в тесте удаляется только последний символ, и только если он - перевод строки