RuntimeModelRegistryImpl implements RuntimeModelRegistry { @Override public Optional<RuntimeModel> single() { return runtimeModels.values().stream().findFirst(); }  @PostConstruct void init(); @Override Optional<RuntimeModel> single(); @Override Optional<RuntimeModel> get(String id); @Override Optional<RuntimeModel> registerFile(String fileName); @Override void setMode(DashbuilderRuntimeMode mode); @Override boolean isEmpty(); @Override DashbuilderRuntimeMode getMode(); @Override void remove(String modelId); Optional<RuntimeModel> register(String id, InputStream fileStream); @Override Collection<String> availableModels();  }
@Test public void testSingle() { RuntimeModel model1 = mock(RuntimeModel.class); when(runtimeModels.values()).thenReturn(Collections.singleton(model1)); assertEquals(model1, registry.single().get()); }