You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
binary-search-tree: extract initialization and rename test class #376
In the binary-search-tree exercise, the test class is named BSTTest and the target class name is BST. For better or for worse, idiomatic Java avoids abbreviations. Also, each test method creates its own instance of BST. Unfortunately, Shalloway's Law applies.
Please:
Rename the test suite to a more descriptive name.
Rename the target class to a congruent name (ideally, the name of the test suite is the name of the class with a Test suffix).
Extract construction of the subject under test in setUp().
@FridaTveit Thank you.
From what I see, the two files involved are:
/exercises/binary-search-tree/src/test/java/BSTTest.java
and
/exercises/binary-search-tree/src/example/java/BST.java
Is this correct?
I am looking at other files to get an idea of a convention for possible test and class names. Do you have a preference or suggestion?
Yup, those are the correct files :) The convention for class names in java is to start with a capital letter, use camelCase and avoid abbreviations. So I would suggest BinarySearchTree.java and BinarySearchTreeTest.java :)
No, from our POLICIES doc you can see that we only require stubs for the first 20 exercises on the track (i.e. the first 20 exercises listed in config.json). This exercises comes later in the track so there shouldn't be any starter implementation :) I hope that makes sense, let me know if you have any questions :)
@FridaTveit Ah, okay...just so I understand completely, there's the test class, and then there's an implemented BST class in the reference folder. What's the purpose of that class? Is the user expected to create a new class in the main/java folder?
Edit: just fetched the exercise locally and noticed that the reference folder isn't included in the project, so that makes more sense. Assuming that the user will add the class as part of the process.
The user will only be provided with the tests, not the reference solution. So yes, they're expected to implement their solution in main/java, where we currently either have a .keep file or a starter implementation, depending on how early in the track the exercise is.
The reference solution is just for contributors. When you make a PR the travis build will run all the tests against the reference solution (removing all the @Ignore annotations so that all the tests run) and check that they pass. That way we know that the tests are correct in that it's possible to write an example solution which passes all the tests. And it makes it easy to see if any change has broken the tests :) The contributing guide also explains how the exercise modules work. Does that make sense? :)
Activity
morrme commentedon Mar 22, 2017
I would like to help, with a little guidance if possible.
FridaTveit commentedon Mar 22, 2017
Great, go for it! :) If there's anything you need help with you can just comment on this issue and we can try to help :)
morrme commentedon Mar 22, 2017
@FridaTveit Thank you.
From what I see, the two files involved are:
/exercises/binary-search-tree/src/test/java/BSTTest.java
and
/exercises/binary-search-tree/src/example/java/BST.java
Is this correct?
I am looking at other files to get an idea of a convention for possible test and class names. Do you have a preference or suggestion?
FridaTveit commentedon Mar 22, 2017
Yup, those are the correct files :) The convention for class names in java is to start with a capital letter, use camelCase and avoid abbreviations. So I would suggest BinarySearchTree.java and BinarySearchTreeTest.java :)
delbertlegg commentedon Oct 9, 2017
I'll take this on!
@FridaTveit I noticed that there is no implementation class yet. Want me to add one with the required stubs?
FridaTveit commentedon Oct 9, 2017
Great! Thanks @delbertlegg! :)
No, from our POLICIES doc you can see that we only require stubs for the first 20 exercises on the track (i.e. the first 20 exercises listed in
config.json). This exercises comes later in the track so there shouldn't be any starter implementation :) I hope that makes sense, let me know if you have any questions :)delbertlegg commentedon Oct 9, 2017
@FridaTveit Ah, okay...just so I understand completely, there's the test class, and then there's an implemented BST class in the reference folder. What's the purpose of that class? Is the user expected to create a new class in the main/java folder?
Edit: just fetched the exercise locally and noticed that the reference folder isn't included in the project, so that makes more sense. Assuming that the user will add the class as part of the process.
FridaTveit commentedon Oct 9, 2017
The user will only be provided with the tests, not the reference solution. So yes, they're expected to implement their solution in
main/java, where we currently either have a.keepfile or a starter implementation, depending on how early in the track the exercise is.The reference solution is just for contributors. When you make a PR the travis build will run all the tests against the reference solution (removing all the
@Ignoreannotations so that all the tests run) and check that they pass. That way we know that the tests are correct in that it's possible to write an example solution which passes all the tests. And it makes it easy to see if any change has broken the tests :) The contributing guide also explains how the exercise modules work. Does that make sense? :)delbertlegg commentedon Oct 9, 2017
RTFM aye! :) Thanks for the explanation. Working on the fix now.