| /** |
| * Copyright (c) 2016 Codetrails GmbH. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| */ |
| package org.eclipse.epp.internal.logging.aeri.ide.processors; |
| |
| import static org.hamcrest.Matchers.is; |
| import static org.junit.Assert.assertThat; |
| import static org.mockito.Mockito.mock; |
| |
| import java.util.Arrays; |
| import java.util.Collection; |
| |
| import org.eclipse.core.runtime.IStatus; |
| import org.eclipse.epp.internal.logging.aeri.ide.IProcessorDescriptor; |
| import org.junit.Test; |
| import org.junit.runner.RunWith; |
| import org.junit.runners.Parameterized; |
| import org.junit.runners.Parameterized.Parameter; |
| import org.junit.runners.Parameterized.Parameters; |
| import org.mockito.Mockito; |
| |
| @RunWith(Parameterized.class) |
| public class PlatformDetailsSectionProcessorsTest { |
| @Parameters |
| public static Collection<Object[]> data() { |
| return Arrays.asList(new Object[][] { |
| // @formatter:off |
| { new InstalledFeaturesProcessor(mockDescriptor("installed features")) }, |
| { new PluginRegistryProcessor(mockDescriptor("installed plugins")) }, |
| { new SystemPropertiesProcessor(mockDescriptor("system properties")) }, |
| { new UserPreferencesProcessor(mockDescriptor("user preferences")) }, |
| // @formatter:on |
| }); |
| } |
| |
| @Parameter(0) |
| public PlatformDetailsSectionProcessor processor; |
| |
| @Test |
| public void testCanContribute() { |
| // if the test fails, a section is probably renamed in the configuration section |
| assertThat(processor.canContribute(mock(IStatus.class)), is(true)); |
| } |
| |
| private static IProcessorDescriptor mockDescriptor(String directive) { |
| IProcessorDescriptor descriptor = mock(IProcessorDescriptor.class); |
| Mockito.when(descriptor.getDescription()).thenReturn(directive); |
| return descriptor; |
| } |
| } |