@Test
@SuppressWarnings("unchecked")
public void shouldPrepareLevelResolvingAllDependenciesFromRepositories() {

    // given
    Level level = level().withName("level").withLevelCreator("levelCreator")
            .withMatcher("matcher").withType("type").build();
    Matcher matcher = mock(Matcher.class);
    when(matcherRepository.getMatcher("matcher")).thenReturn(matcher);
    Type type = mock(Type.class);
    when(typeRepository.getType("type")).thenReturn(type);
    Function levelCreator = mock(Function.class);
    when(functionProvider.getFunction("levelCreator")).thenReturn(levelCreator);
    // when
    PreparedLevel preparedLevel = basicLevelPreparer.prepare(level);
    // then
    assertThat(preparedLevel).hasName("level").hasLevelCreator(levelCreator)
            .hasMatcher(matcher).hasType(type);
}