@Test public void testFindByIdNullKey() throws Exception { CassandraEndpointConfiguration found = endpointConfigurationDao.findById(null); Assert.assertNull(found); }
@Test public void testFindById() throws Exception { List<CassandraEndpointConfiguration> configs = generateConfiguration(3); CassandraEndpointConfiguration expected = configs.get(0); CassandraEndpointConfiguration found = endpointConfigurationDao.findById(expected.getConfigurationHash()); Assert.assertEquals(expected, found); }
@Test public void findEndpointConfigurationByIdTest() { EndpointConfigurationDto configurationDto = generateEndpointConfiguration(); MongoEndpointConfiguration found = endpointConfigurationDao.findById(ByteBuffer.wrap(configurationDto.getConfigurationHash())); Assert.assertNotNull(found); }
@Test public void removeEndpointConfigurationByIdTest() { EndpointConfigurationDto endpointConfiguration = generateEndpointConfiguration(); Assert.assertNotNull(endpointConfiguration); endpointConfigurationDao.removeById(ByteBuffer.wrap(endpointConfiguration.getConfigurationHash())); MongoEndpointConfiguration found = endpointConfigurationDao.findById(ByteBuffer.wrap(endpointConfiguration.getConfigurationHash())); Assert.assertNull(found); }
@Test public void saveEndpointConfigurationTest() { EndpointConfigurationDto configurationDto = generateEndpointConfiguration(); MongoEndpointConfiguration found = endpointConfigurationDao.findById(ByteBuffer.wrap(configurationDto.getConfigurationHash())); Assert.assertNotNull(found); MongoEndpointConfiguration savedDto = endpointConfigurationDao.save(found); Assert.assertNotNull(savedDto); Assert.assertEquals(savedDto, found); }