Source:
<code>public void testCreateNote() throws IOException { Map<String, Object> data = Maps.newHashMap(); data.put("name", "test"); <START> data.put("interpreter", "spark"); <END> Map<String, String> paragraph = Maps.newHashMap(); paragraph.put("title", "title"); paragraph.put("text", "text"); data.put("paragraphs", Lists.newArrayList(paragraph)); PostMethod post = httpPost("/notebook", gson.toJson(data)); assertThat(post, isCreated()); LOG.info("Notebook create response {}", post.getResponseBodyAsString()); Map<String, String> response = (Map<String, String>) gson.fromJson(post.getResponseBodyAsString(), data.getClass()); String noteId = response.get("body"); assertNotNull(noteId); post.releaseConnection(); GetMethod get = httpGet("/notebook/" + noteId); assertThat(get, isAllowed()); Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() { }.getType()); Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body"); assertEquals(resp2Body.get("name"), data.get("name")); get.releaseConnection(); String interpreter = ZeppelinServer.notebook.getInterpreterSettingManager().getDefaultInterpreterSetting(noteId).getName(); assertEquals(interpreter, data.get("interpreter")); List<Paragraph> paragraphs = ZeppelinServer.notebook.getNote(noteId).getParagraphs(); assertEquals(paragraphs.size(), 2); assertEquals(paragraphs.get(0).getTitle(), paragraph.get("title")); assertEquals(paragraphs.get(0).getText(), paragraph.get("text")); ZeppelinServer.notebook.removeNote(noteId, anonymous); }</code><technical_language>test a interpreter? spark is default this set in request</technical_language>

Target:
public void testCreateNote() throws IOException { Map<String, Object> data = Maps.newHashMap(); data.put("name", "test"); data.put("defaultInterpreter", "python"); Map<String, String> paragraph = Maps.newHashMap(); paragraph.put("title", "title"); paragraph.put("text", "text"); data.put("paragraphs", Lists.newArrayList(paragraph)); PostMethod post = httpPost("/notebook", gson.toJson(data)); assertThat(post, isAllowed()); LOG.info("Notebook create response {}", post.getResponseBodyAsString()); Map<String, String> response = (Map<String, String>) gson.fromJson(post.getResponseBodyAsString(), data.getClass()); String noteId = response.get("body"); assertNotNull(noteId); post.releaseConnection(); GetMethod get = httpGet("/notebook/" + noteId); assertThat(get, isAllowed()); Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() { }.getType()); Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body"); assertEquals(resp2Body.get("name"), data.get("name")); get.releaseConnection(); String interpreter = ZeppelinServer.notebook.getInterpreterSettingManager().getDefaultInterpreterSetting(noteId).getName(); assertEquals(interpreter, data.get("defaultInterpreter")); List<Paragraph> paragraphs = ZeppelinServer.notebook.getNote(noteId).getParagraphs(); assertEquals(paragraphs.size(), 2); assertEquals(paragraphs.get(0).getTitle(), paragraph.get("title")); assertEquals(paragraphs.get(0).getText(), paragraph.get("text")); ZeppelinServer.notebook.removeNote(noteId, anonymous); }