@Test
 public void diskSpaceIsDown() throws Exception {
   given(this.fileMock.getFreeSpace()).willReturn(THRESHOLD_BYTES - 10);
   given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10);
   Health health = this.healthIndicator.health();
   assertThat(health.getStatus()).isEqualTo(Status.DOWN);
   assertThat(health.getDetails().get("threshold")).isEqualTo(THRESHOLD_BYTES);
   assertThat(health.getDetails().get("free")).isEqualTo(THRESHOLD_BYTES - 10);
   assertThat(health.getDetails().get("total")).isEqualTo(THRESHOLD_BYTES * 10);
 }
 @Test
 public void customQuery() {
   this.indicator.setDataSource(this.dataSource);
   new JdbcTemplate(this.dataSource).execute("CREATE TABLE FOO (id INTEGER IDENTITY PRIMARY KEY)");
   this.indicator.setQuery("SELECT COUNT(*) from FOO");
   Health health = this.indicator.health();
   System.err.println(health);
   assertNotNull(health.getDetails().get("database"));
   assertEquals(Status.UP, health.getStatus());
   assertNotNull(health.getDetails().get("hello"));
 }
 @Test
 public void database() {
   this.indicator.setDataSource(this.dataSource);
   Health health = this.indicator.health();
   assertNotNull(health.getDetails().get("database"));
   assertNotNull(health.getDetails().get("hello"));
 }
 @Test
 public void error() {
   this.indicator.setDataSource(this.dataSource);
   this.indicator.setQuery("SELECT COUNT(*) from BAR");
   Health health = this.indicator.health();
   assertThat(health.getDetails().get("database"), notNullValue());
   assertEquals(Status.DOWN, health.getStatus());
 }
 @Test
 public void connectionClosed() throws Exception {
   DataSource dataSource = mock(DataSource.class);
   Connection connection = mock(Connection.class);
   given(connection.getMetaData()).willReturn(this.dataSource.getConnection().getMetaData());
   given(dataSource.getConnection()).willReturn(connection);
   this.indicator.setDataSource(dataSource);
   Health health = this.indicator.health();
   assertNotNull(health.getDetails().get("database"));
   verify(connection, times(2)).close();
 }