Skip to content

Conversation

@ilkivoo
Copy link
Owner

@ilkivoo ilkivoo commented Apr 13, 2018

No description provided.

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link

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 {
Copy link

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) {
Copy link

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 {
Copy link

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);
Copy link

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;
Copy link

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);
Copy link

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]);
Copy link

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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну, этот тест проверяет, что две реализации работают одинаково. а вот правильно они работают или нет, непонятно. ну и маловато тестов. на работу с директориями вообще нет проверок

@jzuken
Copy link

jzuken commented Apr 28, 2018

6 баллов

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants