public void createView(View view, boolean replace, boolean ifNotExists) {
        if (ifNotExists) {
            relationsStorage.putIfAbsent(view.name(), view);
        } else if (replace) {
            relationsStorage.put(view.name(), view);
        } else if (!relationsStorage.putIfAbsent(view.name(), view)) {
            throw QueryException.error("Mapping or view already exists: " + view.name());
        }
    }
@Test
    public void when_createsDuplicateViews_then_throws() {
        // given
        View view = view();
        given(relationsStorage.putIfAbsent(eq(view.name()), isA(View.class))).willReturn(false);

        // when
        // then
        assertThatThrownBy(() -> catalog.createView(view, false, false))
                .isInstanceOf(QueryException.class)
                .hasMessageContaining("Mapping or view already exists: name");
        verifyNoInteractions(listener);
    }