Settings { @PostConstruct public void init() { String dataDirParam = getInitParam("documentr.dataDir"); Assert.hasLength(dataDirParam); documentrDataDir = new File(dataDirParam); }  @PostConstruct void init();  }
@Test public void init() { when(servletContext.getInitParameter("documentr.dataDir")).thenReturn("dataDir"); settings.init(); assertEquals(new File("dataDir"), settings.getDocumentrDataDir()); }
@Test public void initMustFallBackToSystemProperty() { System.setProperty("documentr.dataDir", "."); settings.init(); System.setProperty("documentr.dataDir", "nonexistent"); assertEquals(new File("."), settings.getDocumentrDataDir()); }