@Test public void testResolveMainPanelRendererLabelWithResolver2() throws Exception { final CentralViewResolver r1 = context.mock(CentralViewResolver.class, "r1"); final CentralViewResolver r2 = context.mock(CentralViewResolver.class, "r2"); final CentralViewResolver r3 = context.mock(CentralViewResolver.class, "r3"); final Map params = context.mock(Map.class, "params"); context.checking(new Expectations() {{ oneOf(r1).resolveMainPanelRendererLabel(params); will(returnValue(null)); oneOf(r2).resolveMainPanelRendererLabel(params); will(returnValue(new Pair<>("1", "2"))); }}); CentralViewResolverFactoryImpl resolver = new CentralViewResolverFactoryImpl(Arrays.asList(r1, r2, r3)); final Pair<String, String> resolved = resolver.resolveMainPanelRendererLabel(params); assertNotNull(resolved); assertEquals("1", resolved.getFirst()); assertEquals("2", resolved.getSecond()); }
@Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { for (final CentralViewResolver resolver : resolvers) { final Pair<String, String> label = resolver.resolveMainPanelRendererLabel(parameters); if (label != null) { return label; } } return DEFAULT; }
CentralViewResolverFactoryImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { for (final CentralViewResolver resolver : resolvers) { final Pair<String, String> label = resolver.resolveMainPanelRendererLabel(parameters); if (label != null) { return label; } } return DEFAULT; } }
CentralViewResolverFactoryImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { for (final CentralViewResolver resolver : resolvers) { final Pair<String, String> label = resolver.resolveMainPanelRendererLabel(parameters); if (label != null) { return label; } } return DEFAULT; } CentralViewResolverFactoryImpl(final List<CentralViewResolver> resolvers); }
CentralViewResolverFactoryImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { for (final CentralViewResolver resolver : resolvers) { final Pair<String, String> label = resolver.resolveMainPanelRendererLabel(parameters); if (label != null) { return label; } } return DEFAULT; } CentralViewResolverFactoryImpl(final List<CentralViewResolver> resolvers); @Override Pair<String, String> resolveMainPanelRendererLabel(final Map parameters); }
CentralViewResolverFactoryImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { for (final CentralViewResolver resolver : resolvers) { final Pair<String, String> label = resolver.resolveMainPanelRendererLabel(parameters); if (label != null) { return label; } } return DEFAULT; } CentralViewResolverFactoryImpl(final List<CentralViewResolver> resolvers); @Override Pair<String, String> resolveMainPanelRendererLabel(final Map parameters);  }