title: How to get JBOSS Property Value in JUnit Test
body: <pre><code> public static Properties getInstance(String file)
   {
     String path = System.getProperty("jboss.server.base.dir") + File.separator + "configuration" + File.separator + "nxt" + File.separator + file;
     logger.info("path " + path);
     InputStream in = null;
  
     Properties prop = new Properties();
     try
     {
       in = new FileInputStream(path);
       prop.load(in);
     }
     catch (Exception e)
     {
     }
     finally
     {
       if (in != null)
       {
         try
         {
           in.close();
           in = null;
         }
         catch (IOException e)
         {
         }
       }
     }
     return prop;
   }
  </code></pre>
  
  <p>Code used to read from a property file in a specified location in the JBoss server </p>
  
  <pre><code>@Test
  public void getEdgeHealthDignosticValidTest() throws Exception{
    String propertyVal = UtilProperty.getInstance("errorcodes.properties");
    assertTrue(propertyVal.contains("true"));
  }
  </code></pre>
  
  <p>Above is the JUnit test to valid the method. Calling the method to get the property value from the properties file in the mentioned location.
  While running the JUnit test, getting NullPointerException. Since it can't get the <code>System.getProperty("jboss.server.base.dir")</code> value.</p>
  
  <p>How can I get JBoss property in JUnit test.</p>