MCPcopy Create free account
hub / github.com/amigoscode/java-streams / MockData

Class MockData

src/test/java/com/amigoscode/mockdata/MockData.java:18–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16import java.util.List;
17
18public class MockData {
19
20 public static List<Person> getPeople() throws IOException {
21 InputStream inputStream = Resources.getResource("people.json").openStream();
22 String json = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
23 Type listType = new TypeToken<ArrayList<Person>>() {
24 }.getType();
25 return new Gson().fromJson(json, listType);
26 }
27
28 public static List<Car> getCars() throws IOException {
29 InputStream inputStream = Resources.getResource("cars.json").openStream();
30 String json = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
31 Type listType = new TypeToken<ArrayList<Car>>() {
32 }.getType();
33 return new Gson().fromJson(json, listType);
34 }
35
36}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected