cqfn / jpeek

Hosted and command-line calculator of cohesion metrics for Java code
https://i.jpeek.org
MIT License
209 stars 81 forks source link

Added tests cases for OneMethodCreatesLambda #542

Closed LaithAlebrahim closed 8 months ago

LaithAlebrahim commented 8 months ago

I added some tests cases senarios for the doSomething method

LaithAlebrahim commented 8 months ago

@yegor256 can you please review it and let me know if you have any question or concerns about it This the link for the issue Issue 501

yegor256 commented 8 months ago

@LaithAlebrahim thanks for your contribution, but I think that test classes should be kept in src/test/java, instead of src/test/resources

LaithAlebrahim commented 8 months ago

@yegor256 I did that just to keep the test in same folder as the class if you want I'll move it to the src/test/java

@LaithAlebrahim thanks for your contribution, but I think that test classes should be kept in src/test/java, instead of src/test/resources

yegor256 commented 8 months ago

@LaithAlebrahim we keep all tests in src/test/java. Otherwise they just won't run. Also, the files in srt/test/resources are NOT supposed to be tests. They are not a runnable classes.

LaithAlebrahim commented 8 months ago

@LaithAlebrahim we keep all tests in src/test/java. Otherwise they just won't run. Also, the files in srt/test/resources are NOT supposed to be tests. They are not a runnable classes.

@yegor256 Yeah I see, But the class OneMethodCreatesLambda is in src/tests/resources/org/jpeek/samples so should I write tests for it as it's written in the issue or what ,Could you guide me of what am supposing to do )

LaithAlebrahim commented 8 months ago

@yegor256 Should I move the class OneMethodCreatesLambda to the folder src/test/java/org/jpeek/samples after creating samples folder then put the class OneMethodCreatesLambdaTest with other tests

LaithAlebrahim commented 8 months ago

Hi@yegor256 , did you review the changes is that what requried for the task

yegor256 commented 8 months ago

@LaithAlebrahim currently, this PR looks pretty strange. If you are adding new tests to a class, why do you add the class itself? Just create a test file for existing Java class.

LaithAlebrahim commented 8 months ago

@yegor256 Actually because this issue require to test a class that exist in resourcses folder so I did not know what I should do with the class itself cuz I could not import it from folder that has the tests cases that's why I added it there to test the method

yegor256 commented 8 months ago

@LaithAlebrahim I believe, you misunderstood the description of the puzzle. It is expected that you test the result of TLCOM.xsl after it parses OneMethodCreatesLambda.java class. We don't need to create a unit test for OneMethodCreatesLambda.java, since it's not a production class, just a resource for testing of XSL transformations.