private void verify() throws Exception { String motd = applicationContext.getBean("motd", String.class); assertEquals(configuration.getMOTD(), motd); String testingStr = applicationContext.getBean("testingStr", String.class); String expected = configuration.getMOTD() + "-" + configuration.getTesting().getInt(); assertEquals(expected, testingStr); assertEquals(configuration.getMOTD(), bean.getValue()); }
@Test public void testProperties() throws Exception { assertEquals(configuration.getMOTD(), unchangableMotd); String expected = configuration.getMOTD() + "-" + configuration.getTesting().getInt(); assertEquals(expected, unchangableTestingStr); assertEquals(configuration.getMOTD(), bean.getValue()); verify(); Thread.sleep(2000); for (int i = 0; i < 3; i++) { configuration = writeConfig(); Thread.sleep(2000); verify(); } }