@Test(expected = WildcardExpansionLimitExceededException.class)
public void testWildcardQueriesMatchExceedingLimit() {

	SchemaService schemaServiceMock = mock(SchemaService.class);
    List<MetricSchemaRecord> records = new ArrayList<>();
    records.add(new MetricSchemaRecord(null, "scope", "metric0", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric1", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric2", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric3", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric4", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric5", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric6", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric7", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric8", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric9", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric10", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric11", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric12", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric13", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric14", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric15", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric16", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric17", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric18", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric19", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric20", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric21", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric22", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric23", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric24", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric25", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric26", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric27", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric28", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope", "metric29", "source", "unittest"));
    when(schemaServiceMock.get(any(MetricSchemaRecordQuery.class))).thenReturn(records);
    DefaultDiscoveryService discoveryService = new DefaultDiscoveryService(schemaServiceMock, system.getConfiguration(), monitorService);
    Map<String, String> tags = new HashMap<String, String>();
    tags.put("source", "unittest");
    MetricQuery query = new MetricQuery("scope", "metric*", null, System.currentTimeMillis() - (250 * 24 * 60 * 60 * 1000L), System.currentTimeMillis());
    List<MetricQuery> queries = discoveryService.getMatchingQueries(query);
    assertEquals(30, queries.size());
}