0
Я изучаю, как использовать Apache Tika plugin
. Я только что скопировал код с github, и я получаю сообщение об ошибке при модульном тестировании.Grails - Ошибка тестирования тестового приложения плагина Apache Tika
Это unit test
import grails.test.mixin.TestFor
import spock.lang.Specification
/**
* Test for tikaService: try to parse test data.
*/
@TestFor(TikaService)
class TikaServiceSpec extends Specification {
def 'Parse a word file to XML'() {
given:
def file = new File('parserTest.doc')
when:
def xml = service.parseFile(file)
then:
def doc = new XmlSlurper().parseText(xml)
doc.body.p.find{
it.text() == 'This is a simple test document'
}
}
}
Это ошибка я получаю.
Running 5 unit tests... 8 of 8
| Failure: Parse a word file to XML(com.myApp.TikaServiceSpec)
| Condition not satisfied:
doc.body.p.find{ it.text() == 'This is a simple test document' }
| | | |
| | | [email protected]
| | Tika Parser Test
| | This is a simple test document
| Tika Parser Test
| This is a simple test document
Tika Parser Test
This is a simple test document
at com.myApp.TikaServiceSpec.Parse a word file to XML(TikaServiceSpec.groovy:21)
Что я делаю неправильно?
dependencies {
compile('org.apache.tika:tika-core:0.7')
compile('org.apache.tika:tika-parsers:0.7') { excludes "xercesImpl", "xmlParserAPIs", "xml-apis", "log4j" }
}
Вы используете массивно древние версии Apache Тика для начала! Что произойдет, если вы перейдете к самой последней версии, в настоящее время 1.12? – Gagravarr
@Gagravarr Я нашел только 1.11: http://mvnrepository.com/artifact/org.apache.tika/tika-core. Где вы нашли 1.12? –
Это [на главных серверах репо Maven Central] (https://repo1.maven.org/maven2/org/apache/tika/tika-core/1.12/), я думаю, вы, должно быть, нашли разбитое зеркало:/ – Gagravarr