use of org.apache.maven.surefire.providerapi.ProviderParameters in project junit5 by junit-team.
the class JUnitPlatformProviderTests method usesClassNamesForXmlReport.
@Test
void usesClassNamesForXmlReport() throws TestSetFailedException, InvocationTargetException {
String[] classNames = { "org.junit.platform.surefire.provider.JUnitPlatformProviderTests$Sub1Tests", "org.junit.platform.surefire.provider.JUnitPlatformProviderTests$Sub2Tests" };
ProviderParameters providerParameters = providerParametersMock(Sub1Tests.class, Sub2Tests.class);
JUnitPlatformProvider jUnitPlatformProvider = new JUnitPlatformProvider(providerParameters);
TestsToRun testsToRun = newTestsToRun(Sub1Tests.class, Sub2Tests.class);
invokeProvider(jUnitPlatformProvider, testsToRun);
RunListener reporter = providerParameters.getReporterFactory().createReporter();
ArgumentCaptor<ReportEntry> reportEntryArgumentCaptor = ArgumentCaptor.forClass(ReportEntry.class);
verify(reporter, times(2)).testSucceeded(reportEntryArgumentCaptor.capture());
List<ReportEntry> allValues = reportEntryArgumentCaptor.getAllValues();
assertThat(allValues).extracting(ReportEntry::getSourceName).containsExactly(classNames);
}
use of org.apache.maven.surefire.providerapi.ProviderParameters in project junit5 by junit-team.
the class JUnitPlatformProviderTests method parsesConfigurationParameters.
@Test
void parsesConfigurationParameters() {
ProviderParameters providerParameters = providerParametersMock(TestClass1.class);
//
when(providerParameters.getProviderProperties()).thenReturn(singletonMap(JUnitPlatformProvider.CONFIGURATION_PARAMETERS, "foo = true\nbar 42\rbaz: *\r\nqux: EOF"));
JUnitPlatformProvider provider = new JUnitPlatformProvider(providerParameters);
assertEquals(4, provider.configurationParameters.size());
assertEquals("true", provider.configurationParameters.get("foo"));
assertEquals("42", provider.configurationParameters.get("bar"));
assertEquals("*", provider.configurationParameters.get("baz"));
assertEquals("EOF", provider.configurationParameters.get("qux"));
}
use of org.apache.maven.surefire.providerapi.ProviderParameters in project junit5 by junit-team.
the class JUnitPlatformProviderTests method onlyExcludeTagsIsDeclared.
@Test
void onlyExcludeTagsIsDeclared() throws Exception {
Map<String, String> properties = new HashMap<>();
properties.put(JUnitPlatformProvider.EXCLUDE_TAGS, "tagOne, tagTwo");
ProviderParameters providerParameters = providerParametersMock(TestClass1.class);
when(providerParameters.getProviderProperties()).thenReturn(properties);
JUnitPlatformProvider provider = new JUnitPlatformProvider(providerParameters);
assertEquals(1, provider.filters.length);
}
use of org.apache.maven.surefire.providerapi.ProviderParameters in project junit5 by junit-team.
the class JUnitPlatformProviderTests method filtersWithEmptyTagsAreNotRegistered.
@Test
void filtersWithEmptyTagsAreNotRegistered() throws Exception {
Map<String, String> properties = new HashMap<>();
// Here only tagOne is registered as a valid tag and other tags are ignored as they are empty
properties.put(JUnitPlatformProvider.EXCLUDE_GROUPS, "tagOne,");
properties.put(JUnitPlatformProvider.EXCLUDE_TAGS, "");
ProviderParameters providerParameters = providerParametersMock(TestClass1.class);
when(providerParameters.getProviderProperties()).thenReturn(properties);
JUnitPlatformProvider provider = new JUnitPlatformProvider(providerParameters);
assertEquals(1, provider.filters.length);
}
use of org.apache.maven.surefire.providerapi.ProviderParameters in project junit5 by junit-team.
the class JUnitPlatformProviderTests method noFiltersAreCreatedIfTagsAreEmpty.
@Test
void noFiltersAreCreatedIfTagsAreEmpty() throws Exception {
Map<String, String> properties = new HashMap<>();
properties.put(JUnitPlatformProvider.INCLUDE_TAGS, "");
properties.put(JUnitPlatformProvider.INCLUDE_GROUPS, "");
ProviderParameters providerParameters = providerParametersMock(TestClass1.class);
when(providerParameters.getProviderProperties()).thenReturn(properties);
JUnitPlatformProvider provider = new JUnitPlatformProvider(providerParameters);
assertEquals(0, provider.filters.length);
}
Aggregations