-
Notifications
You must be signed in to change notification settings - Fork 0
Test #4
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
base: master
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,36 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
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.
эх, не от той ветки контрольная растёт
| import java.util.function.BiConsumer; | ||
|
|
||
|
|
||
| public class Hasher { |
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.
джавадок потерялся
|
|
||
| public class Md5 { | ||
| private byte[] bytes; | ||
| public Md5(byte[] bytes) { |
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.
метод со строчной буквы должен начинаться
|
|
||
| public class Hasher { | ||
|
|
||
| public Md5 getMd5(Path path) throws NoSuchAlgorithmException, IOException { |
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.
а этот чего не статик тогда?
| message.update(file.getName().getBytes()); | ||
| assert files != null; | ||
| for (File file1 : files) { | ||
| action.accept(message, file1); |
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.
а вот если бы рекурсивно вызвали update, то оно смогло бы обрабатывать и вложенные папки тоже
| } catch (NoSuchAlgorithmException e) { | ||
| System.out.println(e.getMessage()); | ||
| } | ||
| this.file = file; |
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.
ну потенциально и файл может не существовать
| } | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); |
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.
:(
|
|
||
| public class Main { | ||
| public static void main(String[] args) throws IOException, NoSuchAlgorithmException { | ||
| Path path = Paths.get(args[0]); |
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.
а аргумента может не быть, или он будет некорректный. надо бы проверять такие штуки
|
|
||
| public class HasherTest { | ||
| @Test | ||
| public void testCompareGetMdt() throws Exception { |
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.
ну, этот тест проверяет, что две реализации работают одинаково. а вот правильно они работают или нет, непонятно. ну и маловато тестов. на работу с директориями вообще нет проверок
|
6 баллов |
No description provided.