2
respostas

Durante o processo de build mvn, apresentou alguns erros, inclusive, informou erro de banco. há um outro processo antes para executar o mvn package?

[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   AircraftControllerTest.shouldReturn404WhenNotExistAircraftByCode » IllegalState
[ERROR]   AircraftControllerTest.shouldReturnAnAircraftByCode » IllegalState Failed to l...
[ERROR]   AircraftRepositoryTest.shouldReturnAircraftByCodeWhenExistsAnAircraftInDB » IllegalState
[ERROR]   AircraftRepositoryTest.shouldReturnAnEmptyOptionalWhenNotExistsAircraftByCode » IllegalState
[ERROR]   AircraftRepositoryTest.shouldSaveANewAircraft » IllegalState Failed to load Ap...
[ERROR]   LocationControllerIntegrationTest.listAllLocationsShouldReturnAnEmptyList » IllegalState
[ERROR]   LocationControllerIntegrationTest.listAllLocationsShouldReturnListOfLocations » IllegalState
[ERROR]   LocationControllerIntegrationTest.shouldReturnHttpStatus201AndHeaderAttributeLocationWhenValidFormIsInformed » IllegalState
[ERROR]   LocationControllerIntegrationTest.shouldReturnLocationById » IllegalState Fail...
[ERROR]   LocationControllerIntegrationTest.shouldReturnNotFoundForNotFoundLocation » IllegalState
[ERROR]   PromotionalCodeControllerTest.shouldReturnHttpStatus201AndHeaderAttributeLocationWhenValidFormIsInformed » IllegalState
[ERROR]   PromotionalCodeControllerTest.shouldReturnHttpStatus409IfCodeAlreadyExists » IllegalState
[ERROR]   PromotionalCodeRepositoryTest.shouldSaveNewPromotionalCode » IllegalState Fail...
[ERROR]   UserControllerTest.shouldReturn404WhenNotExistUserById » IllegalState Failed t...
[ERROR]   UserControllerTest.shouldReturnAnUserById » IllegalState Failed to load Applic...
[INFO] 
[ERROR] Tests run: 49, Failures: 0, Errors: 15, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  30.951 s
[INFO] Finished at: 2021-07-15T21:37:50-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project clines-api: There are test failures.
[ERROR] 
[ERROR] Please refer to /opt/agile/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
2 respostas

Oi Jean,

Rodando pela IDE acontece o problema?

Tive o mesmo problema, aqui é por que não tenho o postgreeSQL instalado e rodando. Como os testes automatizados sobem a aplicação e a aplicação precisa do banco de dados, ele falha em todos os testes. Para continuar com o curso pulei os testes com o comando:

mvn clean package -DskipTests

ao invés de:

mvn clean package

Porém o certo mesmo seria instalar o portgreeSQL para que os testes sejam executados.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software