Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable per-class test instance lifecycle mode by default for Kotlin classes #991

Closed
2 tasks done
sbrannen opened this issue Jul 28, 2017 · 5 comments
Closed
2 tasks done

Comments

@sbrannen
Copy link
Member

sbrannen commented Jul 28, 2017

Overview

Based on discussions in #905, we have decided to use @TestInstance(Lifecycle.PER_CLASS) by default for test classes written in Kotlin.

Implementation Notes

The following utility (courtesy of @sdeleuze) can be added to ReflectionUtils for detecting Kotlin classes without any external dependencies.

public static boolean isKotlinClass(Class<?> clazz) {
	for (Annotation annotation : clazz.getDeclaredAnnotations()) {
		if (annotation.annotationType().getName().equals("kotlin.Metadata")) {
			return true;
		}
	}
	return false;
}

Deliverables

  • Use Lifecycle.PER_CLASS as the test instance lifecycle mode by default for test classes written in Kotlin.
  • Document in User Guide and Release Notes.
@marcphilipp
Copy link
Member

in progress

@marcphilipp
Copy link
Member

Reopening this issue because the change still needs to be documented in User Guide and Release Notes.

@JLLeitschuh
Copy link
Contributor

I don't agree with this decision. It seems like something that will lead to very confusing behaviour and seems to go against the Junit paradigm.
#905 (comment)

@mlevison
Copy link

mlevison commented Aug 1, 2017 via email

@marcphilipp
Copy link
Member

Let's continue the discussion in #905.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants