-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCacheProcessingTest.java
More file actions
33 lines (27 loc) · 1.01 KB
/
CacheProcessingTest.java
File metadata and controls
33 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.example.modernjava.chapter08;
import com.example.modernjava.data.TextTestData;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Slf4j
class CacheProcessingTest {
private MessageDigest messageDigest;
private List<String> lines;
@BeforeEach
void setUp() throws NoSuchAlgorithmException {
messageDigest = MessageDigest.getInstance("SHA-256");
lines = TextTestData.INFERNO;
}
@Test
void testUpdateDigestTextLines() throws NoSuchAlgorithmException {
final var result = CacheProcessing.updateDigestTextLines(messageDigest, lines);
assertNotNull(result);
assertEquals(3, result.size());
log.info("Update message digest for lines: {}", result);
}
}