@Test
public void testWildcardQueriesMatchWithinLimit() {

	SchemaService schemaServiceMock = mock(SchemaService.class);
    List<MetricSchemaRecord> records = new ArrayList<>();
    records.add(new MetricSchemaRecord(null, "scope0", "metric0", "source", "unittest"));
    records.add(new MetricSchemaRecord(null, "scope1", "metric1", "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[0|1]", "metric[0|1]", tags, 1L, 2L);
    List<MetricQuery> queries = discoveryService.getMatchingQueries(query);
    assertEquals(2, queries.size());
    assertEquals(new MetricQuery("scope0", "metric0", tags, 1L, 2L), queries.get(0));
    assertEquals(new MetricQuery("scope1", "metric1", tags, 1L, 2L), queries.get(1));
}