### Question:
DesignDocument extends OpenCouchDbDocument { public void addView(String name, View v) { views().put(name, v); } DesignDocument();  DesignDocument(String id); @JsonProperty Map<String, View> getViews(); @JsonProperty Map<String, String> getLists(); @JsonProperty Map<String, String> getShows(); @JsonProperty Map<String, String> getFilters(); @JsonProperty Map<String, String> getUpdates(); @JsonProperty String getLanguage(); @JsonProperty void setLanguage(String s); boolean containsView(String name); View get(String viewName); void addView(String name, View v); void removeView(String name); void addListFunction(String name, String function); void removeListFunction(String name); void addShowFunction(String name, String function); void removeShowFunction(String name); void addFilter(String name, String function); void removeFilter(String name); boolean mergeWith(DesignDocument dd, boolean updateOnDiff); boolean mergeWith(DesignDocument dd); final static String ID_PREFIX; static final String AUTO_UPDATE_VIEW_ON_CHANGE; static final String UPDATE_ON_DIFF; }### Answer:
@Test public void view_functions_with_line_breaks_should_serialze_just_fine() throws Exception { dd.addView("by_lastname", new DesignDocument.View("function(doc)\n{ if (doc.Type == 'TestDoc') {\nemit(doc.LastName, doc)\n}\n}")); ObjectMapper om = new ObjectMapper(); String json = om.writeValueAsString(dd); assertNotNull(json); }