HostJdbcDao extends JdbcDaoSupport { public HostAdministrationStatus getAdministrationStatus(long hostId) { String hostAdministrationStatusAsAtring = getJdbcTemplate().queryForObject(sqlGetAdministrationStatus, String.class, hostId); if (StringUtils.isBlank(hostAdministrationStatusAsAtring)) { return null; } return HostAdministrationStatus.valueOf(hostAdministrationStatusAsAtring); }  HostAdministrationStatus getAdministrationStatus(long hostId); void setAdministrationStatus(HostAdministrationStatus hostAdministrationStatus, long hostId); StartType getStartType(long hostId); Status getStatus(long hostId); ResourceState getResourceState(long hostId); List<HypervisorType> getAllHypervisorsTypeInCloud(); boolean isThereAnyHostOnCloudDeactivatedByOurManager(); boolean isThereAnyHostOnPodDeactivatedByOurManager(long id);  }
@Test public void getAdministrationStatusTest() { Mockito.doReturn("Up").when(jdbcTemplate).queryForObject(Mockito.eq(sqlGetAdministrationStatus), Mockito.eq(String.class), Mockito.eq(0l)); HostAdministrationStatus result = spy.getAdministrationStatus(0l); Mockito.verify(jdbcTemplate).queryForObject(Mockito.eq(sqlGetAdministrationStatus), Mockito.eq(String.class), Mockito.eq(0l)); Assert.assertEquals(HostAdministrationStatus.Up, result); }
@Test public void getAdministrationStatusTestIsBlank() { Mockito.doReturn("").when(jdbcTemplate).queryForObject(Mockito.eq(sqlGetAdministrationStatus), Mockito.eq(String.class), Mockito.eq(0l)); HostAdministrationStatus result = spy.getAdministrationStatus(0l); Mockito.verify(jdbcTemplate).queryForObject(Mockito.eq(sqlGetAdministrationStatus), Mockito.eq(String.class), Mockito.eq(0l)); Assert.assertEquals(null, result); }