### Question:
JsonTagLoader { public List<Tag> loadFrom(String json) { Type type = new TypeToken<List<Tag>>() { }.getType(); return new Gson().fromJson(json, type); }  List<Tag> loadFrom(String json);  }### Answer:
@Test public void producesTag() throws Exception { String json = "[{}]"; List<Tag> tags = new JsonTagLoader().loadFrom(json); assertThat(tags.size(), is(1)); }
@Test public void producesTagWithName() throws Exception { String json = "[{\"name\":\"v4.2.1\"}]"; List<Tag> tags = new JsonTagLoader().loadFrom(json); assertThat(tags.get(0).name, is("v4.2.1")); }
@Test public void producesTagFromFullCode() throws Exception { String json = "[\n" + " {\n" + " \"commit\": {\n" + " \"sha\": \"e986584d8aac4f035511f8ea68c495881582a9a3\",\n" + " \"url\": \"https: " },\n" + " \"zipball_url\": \"https: " \"tarball_url\": \"https: " \"name\": \"v4.1.0\"\n" + " }]"; List<Tag> tags = new JsonTagLoader().loadFrom(json); assertThat(tags.get(0).name, is("v4.1.0")); }