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

Handling the space character in the fixtures folder path #99

Conversation

maykon-oliveira
Copy link
Contributor

@maykon-oliveira maykon-oliveira commented May 18, 2022

Opa @mauricioaniche, eu clonei o projeto e tentei rodar os testes unitários, porém estava recebendo uma exceção de java.nio.file.NoSuchFileException, para a pasta fixtures.

Todos os testes que carrega uma classe da pasta fixtures deu esse erro. Aqui está um pedaço de cima do log dos testes:

[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ ck ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.github.mauricioaniche.ck.BindingsTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.174 s <<< FAILURE! - in com.github.mauricioaniche.ck.BindingsTest
[ERROR] com.github.mauricioaniche.ck.BindingsTest  Time elapsed: 0.174 s  <<< ERROR!
java.lang.RuntimeException: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\bindings
	at com.github.mauricioaniche.ck.BindingsTest.setUp(BindingsTest.java:15)
Caused by: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\bindings
	at com.github.mauricioaniche.ck.BindingsTest.setUp(BindingsTest.java:15)
[INFO] Running com.github.mauricioaniche.ck.CBOTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in com.github.mauricioaniche.ck.CBOTest
[ERROR] com.github.mauricioaniche.ck.CBOTest  Time elapsed: 0 s  <<< ERROR!
java.lang.RuntimeException: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\cbo
	at com.github.mauricioaniche.ck.CBOTest.setUp(CBOTest.java:15)
Caused by: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\cbo
	at com.github.mauricioaniche.ck.CBOTest.setUp(CBOTest.java:15)
[INFO] Running com.github.mauricioaniche.ck.ClassTypeTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in com.github.mauricioaniche.ck.ClassTypeTest
[ERROR] com.github.mauricioaniche.ck.ClassTypeTest  Time elapsed: 0 s  <<< ERROR!
java.lang.RuntimeException: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\class-types
	at com.github.mauricioaniche.ck.ClassTypeTest.setUp(ClassTypeTest.java:19)
Caused by: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\class-types
	at com.github.mauricioaniche.ck.ClassTypeTest.setUp(ClassTypeTest.java:19)
[INFO] Running com.github.mauricioaniche.ck.CouplingTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in com.github.mauricioaniche.ck.CouplingTest
[ERROR] com.github.mauricioaniche.ck.CouplingTest  Time elapsed: 0 s  <<< ERROR!
java.lang.RuntimeException: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\cbo
	at com.github.mauricioaniche.ck.CouplingTest.setUp(CouplingTest.java:13)
Caused by: java.nio.file.NoSuchFileException: C:\Users\Maykon%20Oliveira\Documents\Projects\ck\fixtures\cbo
	at com.github.mauricioaniche.ck.CouplingTest.setUp(CouplingTest.java:13)

Acontece que o caminho absoluto para a pasta, no meu ambiente, contem um espaço no meu nome de usuário do Windows, C:\Users\Maykon%20Oliveira\, e esse espaço é codificado para %20. Por conta disso, os arquivos não estavam sendo encontrados.

Eu dei uma pesquisada para saber como resolver esse problema, e estou abrindo esse PR para você dar uma olhada e ver se faz sentido. Mas basicamente é só pegar o caminho para a pasta e decodificar em UTF-8.

É importante verificar se esse problema esta acontecendo com outros usuários do CK, por que bastante gente usa, e ainda não foi relatado esse comportamento.

@mauricioaniche
Copy link
Owner

Sorry, @maykon-oliveira, for the slow reply!! LGTM!

Copy link
Owner

@mauricioaniche mauricioaniche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mauricioaniche mauricioaniche merged commit 8583e1c into mauricioaniche:master Jul 27, 2023
@maykon-oliveira maykon-oliveira deleted the bugfix/no-such-file-exception branch July 27, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants