use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class CucumberTest method testThatParsingErrorsIsNicelyReported.
@Test
void testThatParsingErrorsIsNicelyReported() {
Executable testMethod = () -> new Cucumber(LexerErrorFeature.class);
FeatureParserException actualThrown = assertThrows(FeatureParserException.class, testMethod);
assertThat(actualThrown.getMessage(), equalTo("" + "Failed to parse resource at: classpath:io/cucumber/error/lexer_error.feature\n" + "(1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Feature FA'\n" + "(3:3): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Scenario SA'\n" + "(4:5): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Given GA'\n" + "(5:5): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'When GA'\n" + "(6:5): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Then TA'"));
}
use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class InjectorSourceFactoryTest method failsToInstantiateClassWithNoDefaultConstructor.
@Test
void failsToInstantiateClassWithNoDefaultConstructor() {
InjectorSourceFactory injectorSourceFactory = new InjectorSourceFactory(NoDefaultConstructor.class);
Executable testMethod = injectorSourceFactory::create;
InjectorSourceInstantiationFailed actualThrown = assertThrows(InjectorSourceInstantiationFailed.class, testMethod);
assertAll(() -> assertThat("Unexpected exception message", actualThrown.getMessage(), is(equalTo("Instantiation of 'io.cucumber.guice.InjectorSourceFactoryTest$NoDefaultConstructor' failed. Check the caused by exception and ensure yourInjectorSource implementation is accessible and has a public zero args constructor."))), () -> assertThat("Unexpected exception cause class", actualThrown.getCause(), isA(NoSuchMethodException.class)));
}
use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class InjectorSourceFactoryTest method failsToInstantiateClassNotImplementingInjectorSource.
@Test
void failsToInstantiateClassNotImplementingInjectorSource() {
InjectorSourceFactory injectorSourceFactory = new InjectorSourceFactory(String.class);
Executable testMethod = injectorSourceFactory::create;
InjectorSourceInstantiationFailed actualThrown = assertThrows(InjectorSourceInstantiationFailed.class, testMethod);
assertAll(() -> assertThat("Unexpected exception message", actualThrown.getMessage(), is(equalTo("Instantiation of 'java.lang.String' failed. Check the caused by exception and ensure yourInjectorSource implementation is accessible and has a public zero args constructor."))), () -> assertThat("Unexpected exception cause class", actualThrown.getCause(), isA(ClassCastException.class)));
}
use of org.junit.jupiter.api.function.Executable in project cucumber-jvm by cucumber.
the class CollectionUtilTest method testIllegalArgumentExceptionIsThrownWhenListIsEmpty.
@Test
void testIllegalArgumentExceptionIsThrownWhenListIsEmpty() {
Executable testMethod = () -> CollectionUtil.removeAllExceptFirstElement(list);
IllegalArgumentException expectedThrown = assertThrows(IllegalArgumentException.class, testMethod);
assertThat(expectedThrown.getMessage(), is(equalTo("List must contain at least one element.")));
}
use of org.junit.jupiter.api.function.Executable in project neo4j by neo4j.
the class TokenIndexAccessorTest method readerShouldFindRandomizedUpdates.
@Test
void readerShouldFindRandomizedUpdates() throws Throwable {
Executable additionalOperation = () -> {
};
readerShouldFindRandomizedUpdates(additionalOperation);
}
Aggregations