-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsonParserTest.java
More file actions
29 lines (24 loc) · 899 Bytes
/
JsonParserTest.java
File metadata and controls
29 lines (24 loc) · 899 Bytes
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
package ru.javaops.webapp.util;
import org.junit.Assert;
import org.junit.Test;
import ru.javaops.webapp.model.AbstractSection;
import ru.javaops.webapp.model.Resume;
import ru.javaops.webapp.model.TextSection;
import static ru.javaops.webapp.TestData.RESUME_1;
public class JsonParserTest {
@Test
public void testResume() throws Exception {
String json = JsonParser.write(RESUME_1);
System.out.println(json);
Resume resume = JsonParser.read(json, Resume.class);
Assert.assertEquals(RESUME_1, resume);
}
@Test
public void write() {
AbstractSection section1 = new TextSection("Objective1");
String json = JsonParser.write(section1, AbstractSection.class);
System.out.println(json);
AbstractSection section2 = JsonParser.read(json, AbstractSection.class);
Assert.assertEquals(section1, section2);
}
}