Lab due1124#7
Conversation
|
Oops, I don't think you meant to check in the log files, such as |
|
I did not oops, sorry!
…On Sat, Nov 28, 2020 at 3:01 PM Ellen Spertus ***@***.***> wrote:
Oops, I don't think you meant to check in the log files, such as
hs_err_pid44175.log.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQZHDYL7SGGU3HV72LFTZFDSSF6NVANCNFSM4UGCL4VQ>
.
|
1ea24f2 to
9b10810
Compare
ellenspertus
left a comment
There was a problem hiding this comment.
Since they've been committed, you need to git rm the log files.
Good job on the first part. Slack me when you've done the second part.
| * | ||
| * @param wordApi API that returns a word's information | ||
| * @param wordsApi API that returns a random word | ||
| * @param backingList A list of listeners for changes in objects |
There was a problem hiding this comment.
Parameter descriptions should start with lower-case letters (except for capitalized acronyms). Don't include type information; it's shown automatically. Just refer to the ObservableList<WordRecord> as a list.
| } | ||
|
|
||
| /** | ||
| * Fill backing list with Word of the Day and predefined sample words. |
| /** | ||
| * Fill backing list with Word of the Day and predefined sample words. | ||
| * | ||
| * @param backingList a list of Word Records |
There was a problem hiding this comment.
Per above comment, "the list" or "the list of words".
There was a problem hiding this comment.
Amended to match above.
| @SuppressWarnings("unchecked") | ||
| @Test | ||
| void getWord_True_CorrectWordReturned() { | ||
| assertEquals(SAMPLE_WORD_STRING, SampleData.getWordOfTheDay(mockWordsApi).getWord()); |
There was a problem hiding this comment.
Store SampleData.getWordOfTheDay(mockWordsApi) in a local variable.
There was a problem hiding this comment.
Stored in a variable called "word".
| void getWord_True_CorrectWordReturned() { | ||
| assertEquals(SAMPLE_WORD_STRING, SampleData.getWordOfTheDay(mockWordsApi).getWord()); | ||
| assertEquals(SAMPLE_WORD_DEF, ((Map<Object, Object>) SampleData | ||
| .getWordOfTheDay(mockWordsApi).getDefinitions().get(0)).get("text").toString()); |
There was a problem hiding this comment.
Have an assertion about the size of the list before calling .get() on it.
There was a problem hiding this comment.
Should it be a JUnit assertion, or just an assertion? I decided to go with JUnit for the added information.
| assertEquals(SAMPLE_WORD_STRING, SampleData.getWordOfTheDay(mockWordsApi).getWord()); | ||
| assertEquals(SAMPLE_WORD_DEF, ((Map<Object, Object>) SampleData | ||
| .getWordOfTheDay(mockWordsApi).getDefinitions().get(0)).get("text").toString()); | ||
| } |
There was a problem hiding this comment.
You should also test the frequency.
There was a problem hiding this comment.
Don't call the static method. Use a local variable to reference the WordRecord added to the list, and call getFrequency(), getWord(), and getDefinition() on that.
|
JUnit assertion.
…On Mon, Dec 21, 2020 at 9:47 PM Ben Hamrick ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/test/java/edu/mills/cs180a/wordui/model/SampleDataTest.java
<#7 (comment)>:
> @@ -42,4 +67,30 @@ private static FrequencySummary makeFrequencySummary(List<Object> freqs) {
void testGetFrequencyFromSummary(String word, int year, int count) {
assertEquals(count, SampleData.getFrequencyByYear(mockWordApi, word, year));
}
+
+ private static WordOfTheDay makeWOD(String word, List<Object> defs) {
+ WordOfTheDay wod = mock(WordOfTheDay.class);
+ when(wod.getWord()).thenReturn(word);
+ when(wod.getDefinitions()).thenReturn(defs);
+ return wod;
+ }
+
+ @SuppressWarnings("unchecked")
+ @test
+ void getWord_True_CorrectWordReturned() {
+ assertEquals(SAMPLE_WORD_STRING, SampleData.getWordOfTheDay(mockWordsApi).getWord());
+ assertEquals(SAMPLE_WORD_DEF, ((Map<Object, Object>) SampleData
+ .getWordOfTheDay(mockWordsApi).getDefinitions().get(0)).get("text").toString());
Should it be a JUnit assertion, or just an assertion?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGOZH6TGWH46GF6RWI5APTDSWAXG7ANCNFSM4UGCL4VQ>
.
|
| * @param wordApi API that returns a word's information | ||
| * @param wordsApi API that returns a random word | ||
| * @param backingList A list of listeners for changes in objects | ||
| * @param wordApi returns a word's information |
There was a problem hiding this comment.
Your previous descriptions of wordApi and wordsApi were better.
| assertEquals(SAMPLE_WORD_STRING, SampleData.getWordOfTheDay(mockWordsApi).getWord()); | ||
| assertEquals(SAMPLE_WORD_DEF, ((Map<Object, Object>) SampleData | ||
| .getWordOfTheDay(mockWordsApi).getDefinitions().get(0)).get("text").toString()); | ||
| } |
There was a problem hiding this comment.
Don't call the static method. Use a local variable to reference the WordRecord added to the list, and call getFrequency(), getWord(), and getDefinition() on that.
| ObservableList<WordRecord> backingList = FXCollections.observableArrayList(); | ||
| assertEquals(0, backingList.size()); | ||
| SampleData.addWordOfTheDay(mockWordApi, mockWordsApi, backingList); | ||
| assertEquals(1, backingList.size()); |
There was a problem hiding this comment.
Good, but it would be better to use a local variable to reference the WordRecord added to the list, and call getFrequency(), getWord(), and getDefinition() on that.
There was a problem hiding this comment.
Converted to local variables.
No description provided.