@Test public void testEmptyGoogleMapAPIKeyShouldLog() { GisgraphyConfig gisgraphyConfig = new GisgraphyConfig(); Logger saveLogger = GisgraphyConfig.logger; try { Logger logger = EasyMock.createMock(Logger.class); logger.warn((String) EasyMock.anyObject()); EasyMock.replay(logger); GisgraphyConfig.logger = logger; gisgraphyConfig.setGoogleMapAPIKey(" "); EasyMock.verify(logger); } finally { GisgraphyConfig.logger = saveLogger; } }
@Test public void testSetGoogleMapAPIKeyShouldLogAndSet() { GisgraphyConfig gisgraphyConfig = new GisgraphyConfig(); Logger saveLogger = GisgraphyConfig.logger; try { Logger logger = EasyMock.createMock(Logger.class); logger.info((String) EasyMock.anyObject()); EasyMock.replay(logger); GisgraphyConfig.logger = logger; String googleMapAPIKey = "key"; gisgraphyConfig.setGoogleMapAPIKey(googleMapAPIKey); Assert.assertEquals(googleMapAPIKey, GisgraphyConfig.googleMapAPIKey); EasyMock.verify(logger); } finally { GisgraphyConfig.logger = saveLogger; } }