Java Code Examples for org.junit.runner.Description#getMethodName()
The following examples show how to use
org.junit.runner.Description#getMethodName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParseBpmnModelRule.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Override protected void starting(Description description) { if(description.getAnnotation(BpmnModelResource.class) != null) { Class<?> testClass = description.getTestClass(); String methodName = description.getMethodName(); String resourceFolderName = testClass.getName().replaceAll("\\.", "/"); String bpmnResourceName = resourceFolderName + "." + methodName + ".bpmn"; InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(bpmnResourceName); try { bpmnModelInstance = Bpmn.readModelFromStream(resourceAsStream); } finally { IoUtil.closeSilently(resourceAsStream); } } }
Example 2
Source File: RunningQueriesTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected void failed(Throwable e, Description lastTest) { try { log().error("Last test failed [name=" + lastTest.getMethodName() + ", reason=" + e.getMessage() + "]. Restarting the grid."); // Release the indexing. if (barrier != null) barrier.reset(); stopAllGrids(); beforeTestsStarted(); log().error("Grid restarted."); } catch (Exception restartFailure) { throw new RuntimeException("Failed to recover after test failure [test=" + lastTest.getMethodName() + ", reason=" + e.getMessage() + "]. Subsequent test results of this test class are incorrect.", restartFailure); } }
Example 3
Source File: AbstractMultiTestRunner.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void map(Description source, Description parent) { for (Description child : source.getChildren()) { Description mappedChild; if (child.getMethodName() != null) { mappedChild = Description.createSuiteDescription(String.format("%s [%s](%s)", child.getMethodName(), getDisplayName(), child.getClassName())); parent.addChild(mappedChild); if (!isTestEnabled(new TestDescriptionBackedTestDetails(source, child))) { disabledTests.add(child); } else { enabledTests.add(child); } } else { mappedChild = Description.createSuiteDescription(child.getClassName()); } descriptionTranslations.put(child, mappedChild); map(child, parent); } }
Example 4
Source File: DmnEngineTestRule.java From camunda-engine-dmn with Apache License 2.0 | 6 votes |
protected String expandResourcePath(Description description, String resourcePath) { if (resourcePath.contains("/")) { // already expanded path return resourcePath; } else { Class<?> testClass = description.getTestClass(); if (resourcePath.isEmpty()) { // use test class and method name as resource file name return testClass.getName().replace(".", "/") + "." + description.getMethodName() + "." + DMN_SUFFIX; } else { // use test class location as resource location return testClass.getPackage().getName().replace(".", "/") + "/" + resourcePath; } } }
Example 5
Source File: DmnEngineTestRule.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected String expandResourcePath(Description description, String resourcePath) { if (resourcePath.contains("/")) { // already expanded path return resourcePath; } else { Class<?> testClass = description.getTestClass(); if (resourcePath.isEmpty()) { // use test class and method name as resource file name return testClass.getName().replace(".", "/") + "." + description.getMethodName() + "." + DMN_SUFFIX; } else { // use test class location as resource location return testClass.getPackage().getName().replace(".", "/") + "/" + resourcePath; } } }
Example 6
Source File: AllureRunListener.java From allure1 with Apache License 2.0 | 5 votes |
public void startFakeTestCase(Description description) { String uid = getSuiteUid(description); String name = description.isTest() ? description.getMethodName() : description.getClassName(); TestCaseStartedEvent event = new TestCaseStartedEvent(uid, name); AnnotationManager am = new AnnotationManager(description.getAnnotations()); am.update(event); fireClearStepStorage(); getLifecycle().fire(event); }
Example 7
Source File: GenericContainer.java From testcontainers-java with MIT License | 5 votes |
private TestDescription toDescription(Description description) { return new TestDescription() { @Override public String getTestId() { return description.getDisplayName(); } @Override public String getFilesystemFriendlyName() { return description.getClassName() + "-" + description.getMethodName(); } }; }
Example 8
Source File: ClientSetup.java From usergrid with Apache License 2.0 | 5 votes |
protected void before(Description description) throws IOException { String testClass = description.getTestClass().getName(); String methodName = description.getMethodName(); String name = testClass + "." + methodName; try { restClient.superuserSetup(); superuserToken = restClient.management().token().get(superuserName, superuserPassword); } catch (BadRequestException e) { logger.warn("Error creating superuser, may already exist"); } username = "user_" + name + UUIDUtils.newTimeUUID(); password = username; orgName = "org_" + name + UUIDUtils.newTimeUUID(); appName = "app_" + name + UUIDUtils.newTimeUUID(); organization = restClient.management().orgs().post( new Organization(orgName, username, username + "@usergrid.com", username, password, null)); restClient.management().token().get(username, password); clientCredentials = restClient.management().orgs().org(orgName).credentials().get(Credentials.class); //appCredentials = restClient.management().orgs().org(orgName).app().path//.credentials().get(Credentials.class); ApiResponse appResponse = restClient.management().orgs() .org(organization.getName()).app().post(new Application(appName)); appUuid = (String) appResponse.getEntities().get(0).get("uuid"); application = new Application(appResponse); appCredentials = restClient.pathResource( "management/orgs/"+orgName+"/apps/"+appName+"/credentials" ).get( Credentials.class,true ); refreshIndex(); ApiResponse response = restClient.management().token().post(new Token(username, password)); refreshIndex(); }
Example 9
Source File: RegExTestCaseFilter.java From bazel with Apache License 2.0 | 5 votes |
private static String formatDescriptionName(Description description) { String methodName = (description.getMethodName() == null) ? "" : description.getMethodName(); String className = (description.getClassName() == null) ? "" : description.getClassName(); if (methodName.trim().isEmpty() || className.trim().isEmpty()) { return description.getDisplayName(); } return String.format(TEST_NAME_FORMAT, className, methodName); }
Example 10
Source File: FileSystemWALTest.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override protected void starting(Description description) { targetDir = "target/" + description.getClassName() + "/" + description.getMethodName(); try { fs = FileSystem.get(new URI(targetDir + "/WAL"), conf); fs.delete(new Path(targetDir), true); } catch (IOException | URISyntaxException e) { throw new RuntimeException(e); } fsWAL = new FileSystemWAL(); fsWAL.setFilePath(targetDir + "/WAL"); }
Example 11
Source File: ResultHolder.java From JPPF with Apache License 2.0 | 5 votes |
/** * Process the specified test description. * @param desc the test description. */ private void processDescription(final Description desc) { final String name = desc.getClassName(); final String testName = name + "." + desc.getMethodName(); if (!classes.contains(name)) classes.add(name); if (!tests.contains(testName)) tests.add(testName); }
Example 12
Source File: KurentoTestListener.java From kurento-java with Apache License 2.0 | 5 votes |
@Override public void testStarted(Description description) { String methodName = description.getMethodName(); KurentoTest.setTestMethodName(methodName); log.debug("Starting test {}.{}", testClass.getName(), methodName); invokeServices(ServiceMethod.START, TEST); KurentoTest .logMessage("| TEST STARTING: " + description.getClassName() + "." + methodName); }
Example 13
Source File: DefaultBucketTest.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override protected void starting(Description description) { //lots of test case get around the normal workflow and directly write to file. So should disable bloom filter DefaultBucket.setDisableBloomFilterByDefault(true); TestUtils.deleteTargetTestClassFolder(description); managedStateContext = new MockManagedStateContext(ManagedStateTestUtils.getOperatorContext(9)); applicationPath = "target/" + description.getClassName() + "/" + description.getMethodName(); ((FileAccessFSImpl)managedStateContext.getFileAccess()).setBasePath(applicationPath + "/" + "bucket_data"); managedStateContext.getFileAccess().init(); defaultBucket = new Bucket.DefaultBucket(1); managedStateContext.getBucketsFileSystem().setup(managedStateContext); }
Example 14
Source File: HttpClientTracingHandlerIntegrationTest.java From xio with Apache License 2.0 | 5 votes |
@Override protected void starting(final Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); className = className.substring(className.lastIndexOf('.') + 1); // System.out.println("Starting JUnit-test: " + className + " " + methodName); }
Example 15
Source File: TemporaryJobJsonReports.java From helios with Apache License 2.0 | 4 votes |
public ReportWriter getWriterForTest(final Description testDescription) { return new JsonReportWriter( outputDir, testDescription.getClassName(), testDescription.getMethodName()); }
Example 16
Source File: DynamothSynthesizer.java From nopol with GNU General Public License v2.0 | 4 votes |
@Override public void testFailure(Failure failure) throws Exception { Description description = failure.getDescription(); String key = description.getClassName() + "#" + description.getMethodName(); failedTests.put(key, AngelicExecution.previousValue); }
Example 17
Source File: LoggingTestRule.java From ogham with Apache License 2.0 | 4 votes |
private static String getTestName(Description description) { return description.getTestClass().getSimpleName() + SEPARATOR + description.getMethodName(); }
Example 18
Source File: TeamCityListener.java From dekaf with Apache License 2.0 | 4 votes |
private String getTestName(Description d) { return d.getClassName() + "." + d.getMethodName(); }
Example 19
Source File: LoggingRule.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Returns the name of a test to be logged. * * @param description * the description, must not be {@code null} * @return the description name, never {@code null} */ private String getDescriptionName(final Description description) { return description.getClassName() + '.' + description.getMethodName(); }
Example 20
Source File: FilterRegistry.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Determines if the given {@link Description} is describing a test method. * * @param description * the {@link Description} to check, must not be {@code null} * @return whether the description is describing a test method */ public static boolean isTestMethod(final Description description) { return description.getMethodName() != null; }