Skip to content

Instantly share code, notes, and snippets.

@tuesd4y
Created July 8, 2019 19:54
Show Gist options
  • Save tuesd4y/f1e92c056ba21a35def52a827c900129 to your computer and use it in GitHub Desktop.
Save tuesd4y/f1e92c056ba21a35def52a827c900129 to your computer and use it in GitHub Desktop.
package at.triply.backend.test
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler
import java.net.URLEncoder
class TestAdditionalOutputExtension : TestExecutionExceptionHandler {
override fun handleTestExecutionException(context: ExtensionContext?, throwable: Throwable) {
println("============================================================================================\n" +
"Hey, there seems to be something wrong with the test!\n" +
"If you think this has something to do with heroku, you can check the database here:\n" +
"https://data.heroku.com/datastores/399ca9cb-68b9-4594-a314-daebb483627e\n" +
"Or connect to the remote postgres with this command (but you have to have Chris' file setup):\n" +
"cd \$projdir/eventbackend && heroku pg:psql postgresql-elliptical-67401 --app triply-test\n " +
"===========================================================================================\n" +
"If you found a more complex bug you can report it here: https://url.atlassian.net/secure/CreateIssueDetails!init.jspa?issuetype=10004&pid=10000&reporter=Chris%20Stelzm%C3%BCller&description=Exception+from+junit+Test:" +
URLEncoder.encode(throwable.localizedMessage + " \n::: cause:\n" + throwable.cause + " \n::: stacktrace:\n" +
throwable.stackTrace.take(5).joinToString("\n")))
throw throwable
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment