XMLManipulator implements Manipulatable { @Override public String readConfValue(String file, String propertyName) { try { File confFile = new File(file); if (!confFile.exists()) { System.err.println("File " + file + " does not exists."); return null; } JAXBContext jaxbContext = JAXBContext .newInstance("com.impetus.ankush.agent.action.impl"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Configuration configuration = (Configuration) unmarshaller .unmarshal(confFile); List<Property> propertyList = configuration.getProperty(); for (Iterator<Property> iterator = propertyList.iterator(); iterator .hasNext();) { Property property = iterator.next(); if (property.getName().equals(propertyName)) { return property.getValue(); } } } catch (JAXBException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; }  @Override boolean deleteConfValue(String file, String propertyName); @Override boolean editConfValue(String file, String propertyName,
			String newPropertyValue); @Override boolean writeConfValue(String file, String propertyName,
			String propertyValue); @Override String readConfValue(String file, String propertyName);  }
@Test public void testReadConfValue_1() throws Exception { String propertyName = "test"; String filePath = "test.xml"; String result = xmlManipulator.readConfValue(filePath, propertyName); assertEquals(null, result); }
@Test public void testReadConfValue_2() throws Exception { String propertyName = "0123456789"; String result = xmlManipulator.readConfValue(filePath, propertyName); assertEquals(null, result); }
@Test public void testReadConfValue_3() throws Exception { String propertyName = "distributed"; String result = xmlManipulator.readConfValue(filePath, propertyName); assertEquals("true", result); }