private void checkDropMaterializedView(String mvName, OlapTable olapTable)
            throws DdlException, MetaNotFoundException {
        Preconditions.checkState(olapTable.getState() == OlapTableState.NORMAL, olapTable.getState().name());
        if (mvName.equals(olapTable.getName())) {
            throw new DdlException("Cannot drop base index by using DROP ROLLUP or DROP MATERIALIZED VIEW.");
        }

        if (!olapTable.hasMaterializedIndex(mvName)) {
            throw new MetaNotFoundException(
                    "Materialized view [" + mvName + "] does not exist in table [" + olapTable.getName() + "]");
        }

        long mvIndexId = olapTable.getIndexIdByName(mvName);
        int mvSchemaHash = olapTable.getSchemaHashByIndexId(mvIndexId);
        Preconditions.checkState(mvSchemaHash != -1);

        for (PhysicalPartition partition : olapTable.getPhysicalPartitions()) {
            MaterializedIndex materializedIndex = partition.getIndex(mvIndexId);
            Preconditions.checkNotNull(materializedIndex);
        }
    }
@Test
    public void testCheckDropMaterializedView(@Injectable OlapTable olapTable, @Injectable Partition partition,
                                              @Injectable MaterializedIndex materializedIndex,
                                              @Injectable Database db) {
        String mvName = "mv_1";
        new Expectations() {
            {
                olapTable.getState();
                result = OlapTable.OlapTableState.NORMAL;
                olapTable.getName();
                result = "table1";
                olapTable.hasMaterializedIndex(mvName);
                result = true;
                olapTable.getIndexIdByName(mvName);
                result = 1L;
                olapTable.getSchemaHashByIndexId(1L);
                result = 1;
                olapTable.getPhysicalPartitions();
                result = Lists.newArrayList(partition);
                partition.getIndex(1L);
                result = materializedIndex;
            }
        };
        MaterializedViewHandler materializedViewHandler = new MaterializedViewHandler();
        try {
            Deencapsulation.invoke(materializedViewHandler, "checkDropMaterializedView", mvName, olapTable);
        } catch (Exception e) {
            Assert.fail(e.getMessage());
        }

    }