@Test public void returnsMetaData() throws Exception { DbConfig dbConfig = mock(DbConfig.class); final Result<MetaData> expectedMetaData = mock(Result.class); final MetaDataKey metaDataKey = mock(MetaDataKey.class); when(dbConfig.getMetaData(metaDataKey)).thenReturn(expectedMetaData); DbConfigResolver dbConfigResolver = mock(DbConfigResolver.class); when(dbConfigResolver.resolve(null)).thenReturn(dbConfig); MuleRegistry registry = createMockRegistry(dbConfigResolver); DefaultDbConfigResolver defaultDbConfigResolver = new DefaultDbConfigResolver(registry); final Result<MetaData> metaData = defaultDbConfigResolver.getMetaData(metaDataKey); assertThat(metaData, is(expectedMetaData)); }