Skip to content

Commit

Permalink
Fix JavaDoc errors: Something with Hamcrest and AnalyzeException
Browse files Browse the repository at this point in the history
  • Loading branch information
Balletie committed May 13, 2016
1 parent f914f91 commit 5fa84e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.metaborg.spoofax.shell.client.console;

import static org.hamcrest.CoreMatchers.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
Expand All @@ -13,6 +12,7 @@
import java.io.OutputStream;
import java.util.function.Supplier;

import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.metaborg.spoofax.shell.core.StyledText;
import org.mockito.Mockito;
Expand Down Expand Up @@ -174,23 +174,25 @@ public final void testSize() {
public final void testEntries() {
try {
setUp("asdf" + ENTER + "fdsa" + ENTER + "qwerty" + ENTER + "uiop" + ENTER);
assertThat(hist.allEntries(), hasItems("asdf", "fdsa", "qwerty", "uiop"));
assertThat(hist.allEntries(), CoreMatchers.hasItems("asdf", "fdsa", "qwerty", "uiop"));
// From index is inclusive.
assertThat(hist.entries(HIST_ENTRIES_FROM_INDEX), hasItems("fdsa", "qwerty", "uiop"));
assertThat(hist.entries(HIST_ENTRIES_FROM_INDEX),
CoreMatchers.hasItems("fdsa", "qwerty", "uiop"));
// To index is exclusive.
assertThat(hist.entries(HIST_ENTRIES_FROM_INDEX, HIST_ENTRIES_TO_INDEX),
hasItems("fdsa", "qwerty"));
CoreMatchers.hasItems("fdsa", "qwerty"));
assertThat(hist.entries(HIST_ENTRIES_FROM_INDEX, HIST_ENTRIES_TO_INDEX - 1),
hasItems("fdsa"));
CoreMatchers.hasItems("fdsa"));

// Add a new entry from our own interface.
hist.append("hjkl");
assertThat(hist.allEntries(), hasItems("asdf", "fdsa", "qwerty", "uiop", "hjkl"));
assertThat(hist.allEntries(),
CoreMatchers.hasItems("asdf", "fdsa", "qwerty", "uiop", "hjkl"));
assertThat(hist.entries(HIST_ENTRIES_FROM_INDEX),
hasItems("fdsa", "qwerty", "uiop", "hjkl"));
CoreMatchers.hasItems("fdsa", "qwerty", "uiop", "hjkl"));
// This one should not have changed.
assertThat(hist.entries(HIST_ENTRIES_FROM_INDEX, HIST_ENTRIES_TO_INDEX),
hasItems("fdsa", "qwerty"));
CoreMatchers.hasItems("fdsa", "qwerty"));
} catch (IOException e) {
fail("Should not happen");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.metaborg.spoofax.shell.client.console;

import static org.hamcrest.CoreMatchers.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertThat;
Expand All @@ -10,6 +9,7 @@
import java.io.File;
import java.io.IOException;

import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -77,12 +77,12 @@ public void testDelegateSwitch() {
@Test
public void testPersistentHistory() {
try {
assertThat(hist.allEntries(), hasItems("asdf", "fdsa"));
assertThat(hist.allEntries(), CoreMatchers.hasItems("asdf", "fdsa"));

// Now load entries from disk. The file is empty, so allEntries should still have all
// in-memory contents as before.
systemUnderTest().loadFromDisk();
assertThat(hist.allEntries(), hasItems("asdf", "fdsa"));
assertThat(hist.allEntries(), CoreMatchers.hasItems("asdf", "fdsa"));

hist.append("qwerty");
hist.append("hjkl");
Expand All @@ -93,7 +93,7 @@ public void testPersistentHistory() {

// Load it back and check that the entries are there.
systemUnderTest().loadFromDisk();
assertThat(hist.allEntries(), hasItems("qwerty", "hjkl"));
assertThat(hist.allEntries(), CoreMatchers.hasItems("qwerty", "hjkl"));
} catch (IOException e) {
fail("Should not happen");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public void testDescription() {
* Test parsing and writing to a temp file once.
* @throws IOException when the file could not be opened
* @throws MetaborgException when analyzing fails
* @throws AnalyzeException when the file contains invalid syntax
*/
@Test(expected = MetaborgException.class)
public void testAnalyzeOnce() throws IOException, MetaborgException {
Expand Down

0 comments on commit 5fa84e1

Please sign in to comment.