ClusterJdbcDao extends JdbcDaoSupport { public ClusterAdministrationStatus getClusterAdministrationStatus(long clusterId) { String statusAsString = getJdbcTemplate().queryForObject(sqlGetClusterAdministrationStatus, String.class, clusterId); if (statusAsString == null) { return null; } return ClusterAdministrationStatus.valueOf(statusAsString); }  ClusterAdministrationStatus getClusterAdministrationStatus(long clusterId); void setClusterAdministrationStatus(ClusterAdministrationStatus clusterConsolidationStatus, long clusterId); Date getClusterLastAdminstration(long clusterId); void setClusterLastAdministration(Date date, long clusterId);  }
@Test public void getClusterAdministrationStatusTest() { Mockito.doReturn("Done").when(jdbcTemplate).queryForObject(Mockito.eq(sqlGetClusterAdministrationStatus), Mockito.eq(String.class), Mockito.anyString()); ClusterAdministrationStatus result = spy.getClusterAdministrationStatus(0l); Mockito.verify(jdbcTemplate).queryForObject(Mockito.eq(sqlGetClusterAdministrationStatus), Mockito.eq(String.class), Mockito.anyString()); Assert.assertNotNull(result); }
@Test public void getClusterAdministrationStatusTestReturnNull() { Mockito.doReturn(null).when(jdbcTemplate).queryForObject(Mockito.eq(sqlGetClusterAdministrationStatus), Mockito.eq(String.class), Mockito.anyString()); ClusterAdministrationStatus result = spy.getClusterAdministrationStatus(0l); Mockito.verify(jdbcTemplate).queryForObject(Mockito.eq(sqlGetClusterAdministrationStatus), Mockito.eq(String.class), Mockito.anyString()); Assert.assertNull(result); }