public Optional<ViewDefinition> getViewDefinition(QualifiedObjectName viewName)
    {
        if (!viewDefinitions.containsKey(viewName)) {
            throw new PrestoException(VIEW_NOT_FOUND, format("View %s not found, the available view names are: %s", viewName, viewDefinitions.keySet()));
        }

        try {
            return viewDefinitions.get(viewName).get();
        }
        catch (InterruptedException ex) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(ex);
        }
        catch (ExecutionException ex) {
            throwIfUnchecked(ex.getCause());
            throw new RuntimeException(ex.getCause());
        }
    }
@Test
    public void testGetViewDefinitionNotPresent()
    {
        try {
            metadataHandle.getViewDefinition(QualifiedObjectName.valueOf("tpch.s1.t2"));
            fail("PrestoException not thrown for invalid view");
        }
        catch (Exception e) {
            assertTrue(e instanceof PrestoException);
            PrestoException prestoException = (PrestoException) e;
            assertEquals(prestoException.getErrorCode(), VIEW_NOT_FOUND.toErrorCode());
            assertEquals(prestoException.getMessage(), "View tpch.s1.t2 not found, the available view names are: [tpch.s1.t1]");
        }
    }