я следующий тест ...PowerMockito метания ClassNotPreparedException даже с @PrepareForTest помощью Scala Test
import org.scalatest.junit.JUnitRunner
...
@PowerMockRunnerDelegate(classOf[JUnitRunner])
@PrepareForTest(Array(classOf[AuditLog]))
class ConnectorAPITest extends path.FreeSpec with ShouldMatchers {
"Mocked Tests" - {
println("This got called in the mocked tests.")
PowerMockito.mockStatic(classOf[AuditLog]);
...
}
}
Но когда я бегу я получаю ...
An exception or error caused a run to abort: The class com.paxata.services.log.AuditLog not prepared for test.
To prepare this class, add class to the '@PrepareForTest' annotation.
In case if you don't use this annotation, add the annotation on class or method level.
org.powermock.api.mockito.ClassNotPreparedException:
The class com.paxata.services.log.AuditLog not prepared for test.
To prepare this class, add class to the '@PrepareForTest' annotation.
Который не имеет смысла учитывая, что аннотация уже есть? Это идиосинкразия теста Scala?
Что произойдет, если вы пытаетесь использовать полный путь к классам в аннотации? – Yawar
Я постараюсь, что сегодня, если смогу – Jackie