@Test public void shouldParseMotechProperties() { MotechProperties motechProperties = (MotechProperties) reader.readFromFile("/motech-properties.json", MotechProperties.class); assertThat(motechProperties.size(), IsEqual.equalTo(14)); assertThat(motechProperties.get("case_name"), IsEqual.equalTo("Pankaja")); assertThat(motechProperties.get("family_number"), IsEqual.equalTo("")); assertThat(motechProperties.get("external_id"), IsNull.nullValue()); }
public Object readFromFile(String classpathFile, Type ofType) { InputStream inputStream = getClass().getResourceAsStream(classpathFile); if (inputStream == null) { throw new MotechException("File not found in classpath: " + classpathFile); } try { String jsonText = IOUtils.toString(inputStream); return from(jsonText, ofType, standardTypeAdapters, false); } catch (IOException e) { throw new JsonIOException(e); } }
MotechJsonReader { public Object readFromFile(String classpathFile, Type ofType) { InputStream inputStream = getClass().getResourceAsStream(classpathFile); if (inputStream == null) { throw new MotechException("File not found in classpath: " + classpathFile); } try { String jsonText = IOUtils.toString(inputStream); return from(jsonText, ofType, standardTypeAdapters, false); } catch (IOException e) { throw new JsonIOException(e); } } }
MotechJsonReader { public Object readFromFile(String classpathFile, Type ofType) { InputStream inputStream = getClass().getResourceAsStream(classpathFile); if (inputStream == null) { throw new MotechException("File not found in classpath: " + classpathFile); } try { String jsonText = IOUtils.toString(inputStream); return from(jsonText, ofType, standardTypeAdapters, false); } catch (IOException e) { throw new JsonIOException(e); } } MotechJsonReader();  MotechJsonReader(FieldNamingStrategy fieldNamingStrategy); }
MotechJsonReader { public Object readFromFile(String classpathFile, Type ofType) { InputStream inputStream = getClass().getResourceAsStream(classpathFile); if (inputStream == null) { throw new MotechException("File not found in classpath: " + classpathFile); } try { String jsonText = IOUtils.toString(inputStream); return from(jsonText, ofType, standardTypeAdapters, false); } catch (IOException e) { throw new JsonIOException(e); } } MotechJsonReader();  MotechJsonReader(FieldNamingStrategy fieldNamingStrategy); Object readFromStream(InputStream stream, Type ofType); Object readFromStreamOnlyExposeAnnotations(InputStream stream, Type ofType); Object readFromFile(String classpathFile, Type ofType); Object readFromString(String text, Type ofType); Object readFromStringOnlyExposeAnnotations(String text, Type ofType); Object readFromString(String text, Type ofType, Map<Type, Object> typeAdapters); }
MotechJsonReader { public Object readFromFile(String classpathFile, Type ofType) { InputStream inputStream = getClass().getResourceAsStream(classpathFile); if (inputStream == null) { throw new MotechException("File not found in classpath: " + classpathFile); } try { String jsonText = IOUtils.toString(inputStream); return from(jsonText, ofType, standardTypeAdapters, false); } catch (IOException e) { throw new JsonIOException(e); } } MotechJsonReader();  MotechJsonReader(FieldNamingStrategy fieldNamingStrategy); Object readFromStream(InputStream stream, Type ofType); Object readFromStreamOnlyExposeAnnotations(InputStream stream, Type ofType); Object readFromFile(String classpathFile, Type ofType); Object readFromString(String text, Type ofType); Object readFromStringOnlyExposeAnnotations(String text, Type ofType); Object readFromString(String text, Type ofType, Map<Type, Object> typeAdapters);  }