Skip to content

Instantly share code, notes, and snippets.

@yangweigbh
Created July 4, 2020 03:47
Show Gist options
  • Save yangweigbh/6252c03a499a640967c1b6301d3fa3e1 to your computer and use it in GitHub Desktop.
Save yangweigbh/6252c03a499a640967c1b6301d3fa3e1 to your computer and use it in GitHub Desktop.
fun getState(): BenchmarkState {
// Note: this is an explicit method instead of an accessor to help convey it's only for Java
// Kotlin users should call the [measureRepeated] method.
if (!applied) {
throw IllegalStateException(
"Cannot get state before BenchmarkRule is applied to a test. Check that your " +
"BenchmarkRule is annotated correctly (@Rule in Java, @get:Rule in Kotlin)."
)
}
return internalState
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment