Conversation
added 3 commits
March 23, 2018 03:02
jzuken
reviewed
Apr 28, 2018
| @@ -0,0 +1,36 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| import java.util.function.BiConsumer; | ||
|
|
||
|
|
||
| public class Hasher { |
|
|
||
| public class Md5 { | ||
| private byte[] bytes; | ||
| public Md5(byte[] bytes) { |
There was a problem hiding this comment.
метод со строчной буквы должен начинаться
|
|
||
| public class Hasher { | ||
|
|
||
| public Md5 getMd5(Path path) throws NoSuchAlgorithmException, IOException { |
| message.update(file.getName().getBytes()); | ||
| assert files != null; | ||
| for (File file1 : files) { | ||
| action.accept(message, file1); |
There was a problem hiding this comment.
а вот если бы рекурсивно вызвали update, то оно смогло бы обрабатывать и вложенные папки тоже
| } catch (NoSuchAlgorithmException e) { | ||
| System.out.println(e.getMessage()); | ||
| } | ||
| this.file = file; |
There was a problem hiding this comment.
ну потенциально и файл может не существовать
| } | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); |
|
|
||
| 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.
а аргумента может не быть, или он будет некорректный. надо бы проверять такие штуки
|
|
||
| public class HasherTest { | ||
| @Test | ||
| public void testCompareGetMdt() throws Exception { |
There was a problem hiding this comment.
ну, этот тест проверяет, что две реализации работают одинаково. а вот правильно они работают или нет, непонятно. ну и маловато тестов. на работу с директориями вообще нет проверок
|
6 баллов |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.