@Test public void given_json_view_file_with_unix_line_endings_then_should_parse_successfully() throws IOException { SimpleViewGenerator generator = new SimpleViewGenerator(); DesignDocument.View view = generator.loadViewFromString(new ObjectMapper(), " {\"map\":\"function(doc) {\n emit(doc._id, doc);\n }\n\"}"); assertEquals("function(doc) { emit(doc._id, doc); }", view.getMap()); }
public static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json) throws IOException { return objectMapper.readValue(json.replaceAll(LINE_ENDING_DOS, "").replaceAll(LINE_ENDING_UNIX, ""), DesignDocument.View.class); }
SimpleViewGenerator { public static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json) throws IOException { return objectMapper.readValue(json.replaceAll(LINE_ENDING_DOS, "").replaceAll(LINE_ENDING_UNIX, ""), DesignDocument.View.class); } }
SimpleViewGenerator { public static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json) throws IOException { return objectMapper.readValue(json.replaceAll(LINE_ENDING_DOS, "").replaceAll(LINE_ENDING_UNIX, ""), DesignDocument.View.class); }  }
SimpleViewGenerator { public static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json) throws IOException { return objectMapper.readValue(json.replaceAll(LINE_ENDING_DOS, "").replaceAll(LINE_ENDING_UNIX, ""), DesignDocument.View.class); }  DesignDocument.View generateFindByView(String propertyName,
			String typeDiscriminator); DesignDocument.View generateFindByIterableView(String propertyName,
			String typeDiscriminator); DesignDocument.View generateDocRefsAsSetWithOrderByView(
			String backRef, String fieldName, String orderBy,
			String typeDiscriminator); DesignDocument.View generateDocRefsAsSetView(String backRef,
			String fieldName, String typeDiscriminator); Map<String, DesignDocument.View> generateViews(
			final Object repository); Map<String, DesignDocument.View> generateViewsFromPersistentType(
			final Class<?> persistentType); boolean shouldLoadFunctionFromClassPath(String function); static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json); }
SimpleViewGenerator { public static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json) throws IOException { return objectMapper.readValue(json.replaceAll(LINE_ENDING_DOS, "").replaceAll(LINE_ENDING_UNIX, ""), DesignDocument.View.class); }  DesignDocument.View generateFindByView(String propertyName,
			String typeDiscriminator); DesignDocument.View generateFindByIterableView(String propertyName,
			String typeDiscriminator); DesignDocument.View generateDocRefsAsSetWithOrderByView(
			String backRef, String fieldName, String orderBy,
			String typeDiscriminator); DesignDocument.View generateDocRefsAsSetView(String backRef,
			String fieldName, String typeDiscriminator); Map<String, DesignDocument.View> generateViews(
			final Object repository); Map<String, DesignDocument.View> generateViewsFromPersistentType(
			final Class<?> persistentType); boolean shouldLoadFunctionFromClassPath(String function); static DesignDocument.View loadViewFromString(ObjectMapper objectMapper, String json);  }