HostJdbcDao extends JdbcDaoSupport { public List<HypervisorType> getAllHypervisorsTypeInCloud() { List<String> hypervisorTypesAsString = getJdbcTemplate().queryForList(sqlSetAllHypervisorsTypeInCloud, String.class); List<HypervisorType> hypervisorTypes = new ArrayList<>(); for (String s : hypervisorTypesAsString) { hypervisorTypes.add(HypervisorType.valueOf(s)); } return hypervisorTypes; }  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 getAllHypervisorsTypeInCloudTest() { List<String> hypervisorTypesAsString = new ArrayList<>(); hypervisorTypesAsString.add("XenServer"); hypervisorTypesAsString.add("KVM"); Mockito.doReturn(hypervisorTypesAsString).when(jdbcTemplate).queryForList(Mockito.eq(sqlSetAllHypervisorsTypeInCloud), Mockito.eq(String.class)); List<HypervisorType> result = spy.getAllHypervisorsTypeInCloud(); Mockito.verify(jdbcTemplate).queryForList(Mockito.eq(sqlSetAllHypervisorsTypeInCloud), Mockito.eq(String.class)); Assert.assertEquals(HypervisorType.XenServer, result.get(0)); Assert.assertEquals(HypervisorType.KVM, result.get(1)); }