-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBlobTest.java
More file actions
51 lines (44 loc) · 1.66 KB
/
BlobTest.java
File metadata and controls
51 lines (44 loc) · 1.66 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import org.junit.jupiter.api.Test;
public class BlobTest {
@Test
void testSha1() {
String expected = "f187ae69bdfb0f1510f108534b241abaa5a4ca72";
String actual = Blob.Sha1("wyattvanamburg77");
assertTrue(expected.equals(actual));
}
@Test
void testGetContents() throws IOException {
Blob.writeFile("f187ae69bdfb0f1510f108534b241abaa5a4ca72", "file1.txt");
String expectedContents = "f187ae69bdfb0f1510f108534b241abaa5a4ca72";
String actual = Blob.readFile("file1.txt");
File f = new File ("file1.txt");
f.delete();
assertTrue(expectedContents.equals(actual));
}
@Test
void testReadFile() throws IOException {
Blob.writeFile("f187ae69bdfb0f1510f108534b241abaa5a4ca72", "file1.txt");
String expectedContents = "f187ae69bdfb0f1510f108534b241abaa5a4ca72";
String actual = Blob.readFile("file1.txt");
File f = new File ("file1.txt");
f.delete();
assertTrue(expectedContents.equals(actual));
}
@Test
void testToSha1() throws IOException {
Blob.writeFile("wyattvanamburg77", "file1.txt");
String expectedContents = "f187ae69bdfb0f1510f108534b241abaa5a4ca72";
String actual = Blob.toSha1("file1.txt");
assertTrue(expectedContents.equals(actual));
}
@Test
void testWriteFile() throws IOException {
String expected = "wyattvanamburg77";
Blob.writeFile("wyattvanamburg77", "file1.txt");
String actual = Blob.readFile("file1.txt");
assertTrue(expected.equals(actual));
}
}