@Test
public void testOverwriteSameTimeSeriesDBMappingViaMapServiceToClusterInNamespace() throws Exception {

    Long testNamespaceId = 1L;
    Namespace testNamespace = createTestNamespace(testNamespaceId, TEST_STREAMING_ENGINE, TEST_TIME_SERIES_DB);
    Collection<NamespaceServiceClusterMap> existingMappings = createTestMappingsForExisting(testNamespaceId);
    new Expectations() {{
        environmentService.getNamespace(testNamespaceId);
        result = testNamespace;
        environmentService.listServiceClusterMapping(testNamespaceId);
        result = existingMappings;
    }};
    NamespaceServiceClusterMap existingTimeSeriesDBMapping = existingMappings.stream()
            .filter(m -> m.getServiceName().equals(TEST_TIME_SERIES_DB)).findAny().get();
    namespaceCatalogResource.mapServiceToClusterInNamespace(testNamespaceId, existingTimeSeriesDBMapping, securityContext);
    new Verifications() {{
        environmentService.addOrUpdateServiceClusterMapping(withAny(new NamespaceServiceClusterMap()));
        times = 1;
    }};
}