This is an automated email from the ASF dual-hosted git repository.
pdallig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 020d587 [ZEPPELIN-5641] Remove Google Truth to have uniform tests.
020d587 is described below
commit 020d587a4deafc47bbf97887d14802c7de0be5fe
Author: Philipp Dallig <[email protected]>
AuthorDate: Fri Sep 17 16:23:19 2021 +0200
[ZEPPELIN-5641] Remove Google Truth to have uniform tests.
### What is this PR for?
This PR removes google truth to unify the tests.
### What type of PR is it?
Refactoring
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-5641
### How should this be tested?
* CI
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Philipp Dallig <[email protected]>
Closes #4291 from Reamer/remove_truth and squashes the following commits:
dc1443793 [Philipp Dallig] Remove Google Truth to have uniform tests.
---
zeppelin-zengine/pom.xml | 16 ---
.../org/apache/zeppelin/search/SearchService.java | 13 +-
.../notebook/repo/GitNotebookRepoTest.java | 136 +++++++++++----------
.../notebook/repo/NotebookRepoSyncTest.java | 14 +--
.../apache/zeppelin/search/LuceneSearchTest.java | 67 +++++-----
5 files changed, 116 insertions(+), 130 deletions(-)
diff --git a/zeppelin-zengine/pom.xml b/zeppelin-zengine/pom.xml
index 114311f..f0aa0d5 100644
--- a/zeppelin-zengine/pom.xml
+++ b/zeppelin-zengine/pom.xml
@@ -40,9 +40,6 @@
<frontend.maven.plugin.version>1.3</frontend.maven.plugin.version>
<commons.vfs2.version>2.6.0</commons.vfs2.version>
<eclipse.jgit.version>4.5.4.201711221230-r</eclipse.jgit.version>
- <!--test library versions-->
- <google.truth.version>0.27</google.truth.version>
- <google.testing.nio.version>0.32.0-alpha</google.testing.nio.version>
</properties>
<dependencies>
@@ -233,19 +230,6 @@
</dependency>
<dependency>
- <groupId>com.google.truth</groupId>
- <artifactId>truth</artifactId>
- <version>${google.truth.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
diff --git
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java
index b0ffcd3..b4bd56e 100644
---
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java
+++
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java
@@ -47,7 +47,7 @@ public abstract class SearchService extends
NoteEventAsyncListener {
* Updates note index for the given note, only update index of note meta
info,
* such as id,name. Paragraph index will be done in method
updateParagraphIndex.
*
- * @param note a Note to update index for
+ * @param noteId a NoteId to update index for
* @throws IOException
*/
public abstract void updateNoteIndex(String noteId);
@@ -55,11 +55,12 @@ public abstract class SearchService extends
NoteEventAsyncListener {
/**
* Updates paragraph index for the given paragraph.
*
- * @param paragraph a Paragraph to update index for
+ * @param noteId a NoteId to update index for
+ * @param paragraphId a Paragraph to update index for
* @throws IOException
*/
- public abstract void updateParagraphIndex(String nodeId, String paragraphId);
+ public abstract void updateParagraphIndex(String noteId, String paragraphId);
/**
* Indexes the given note.
@@ -82,10 +83,10 @@ public abstract class SearchService extends
NoteEventAsyncListener {
public abstract void deleteNoteIndex(String noteId);
/**
- * Deletes doc for a given
+ * Deletes doc for a given NoteId and ParagraphId
*
- * @param noteId
- * @param p
+ * @param noteId a NoteId to delete index for
+ * @param paragraphId a ParagraphId to delete index for
* @throws IOException
*/
public abstract void deleteParagraphIndex(String noteId, String paragraphId);
diff --git
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java
index aaad8a5..bb74178 100644
---
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java
+++
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java
@@ -17,7 +17,11 @@
package org.apache.zeppelin.notebook.repo;
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import java.io.File;
@@ -25,7 +29,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
-import com.google.common.truth.Truth;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.zeppelin.conf.ZeppelinConfiguration;
@@ -92,52 +95,52 @@ public class GitNotebookRepoTest {
public void initNonemptyNotebookDir() throws IOException, GitAPIException {
//given - .git does not exit
File dotGit = new File(String.join(File.separator, notebooksDir, ".git"));
- assertThat(dotGit.exists()).isEqualTo(false);
+ assertFalse(dotGit.exists());
//when
notebookRepo = new GitNotebookRepo(conf);
//then
Git git = notebookRepo.getGit();
- Truth.assertThat(git).isNotNull();
+ assertNotNull(git);
- assertThat(dotGit.exists()).isEqualTo(true);
- assertThat(notebookRepo.list(null)).isNotEmpty();
+ assertTrue(dotGit.exists());
+ assertFalse(notebookRepo.list(null).isEmpty());
List<DiffEntry> diff = git.diff().call();
// no commit, diff isn't empty
- Truth.assertThat(diff).isNotEmpty();
+ assertFalse(diff.isEmpty());
}
@Test
public void showNotebookHistoryEmptyTest() throws GitAPIException,
IOException {
//given
notebookRepo = new GitNotebookRepo(conf);
- assertThat(notebookRepo.list(null)).isNotEmpty();
+ assertFalse(notebookRepo.list(null).isEmpty());
//when
List<Revision> testNotebookHistory =
notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH, null);
//then
//no initial commit, empty history
- assertThat(testNotebookHistory).isEmpty();
+ assertTrue(testNotebookHistory.isEmpty());
}
@Test
public void showNotebookHistoryMultipleNotesTest() throws IOException {
//initial checks
notebookRepo = new GitNotebookRepo(conf);
- assertThat(notebookRepo.list(null)).isNotEmpty();
- assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID)).isTrue();
- assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID2)).isTrue();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null)).isEmpty();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID2, TEST_NOTE_PATH2,
null)).isEmpty();
+ assertFalse(notebookRepo.list(null).isEmpty());
+ assertTrue(containsNote(notebookRepo.list(null), TEST_NOTE_ID));
+ assertTrue(containsNote(notebookRepo.list(null), TEST_NOTE_ID2));
+ assertTrue(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).isEmpty());
+ assertTrue(notebookRepo.revisionHistory(TEST_NOTE_ID2, TEST_NOTE_PATH2,
null).isEmpty());
//add commit to both notes
notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "first commit,
note1", null);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(1);
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
notebookRepo.checkpoint(TEST_NOTE_ID2, TEST_NOTE_PATH2, "first commit,
note2", null);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID2, TEST_NOTE_PATH2,
null).size()).isEqualTo(1);
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID2,
TEST_NOTE_PATH2, null).size());
//modify, save and checkpoint first note
Note note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
@@ -148,12 +151,11 @@ public class GitNotebookRepoTest {
p.setConfig(config);
p.setText("%md note1 test text");
notebookRepo.save(note, null);
- assertThat(notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "second
commit, note1", null)).isNotNull();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(2);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID2, TEST_NOTE_PATH2,
null).size()).isEqualTo(1);
- assertThat(notebookRepo.checkpoint(TEST_NOTE_ID2, TEST_NOTE_PATH2, "first
commit, note2", null))
- .isEqualTo(Revision.EMPTY);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID2, TEST_NOTE_PATH2,
null).size()).isEqualTo(1);
+ assertNotNull(notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH,
"second commit, note1", null));
+ assertEquals(2, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID2,
TEST_NOTE_PATH2, null).size());
+ assertEquals(Revision.EMPTY, notebookRepo.checkpoint(TEST_NOTE_ID2,
TEST_NOTE_PATH2, "first commit, note2", null));
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID2,
TEST_NOTE_PATH2, null).size());
//modify, save and checkpoint second note
note = notebookRepo.get(TEST_NOTE_ID2, TEST_NOTE_PATH2, null);
@@ -164,22 +166,22 @@ public class GitNotebookRepoTest {
p.setConfig(config);
p.setText("%md note2 test text");
notebookRepo.save(note, null);
- assertThat(notebookRepo.checkpoint(TEST_NOTE_ID2, TEST_NOTE_PATH2, "second
commit, note2", null)).isNotNull();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(2);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID2, TEST_NOTE_PATH2,
null).size()).isEqualTo(2);
+ assertNotNull(notebookRepo.checkpoint(TEST_NOTE_ID2, TEST_NOTE_PATH2,
"second commit, note2", null));
+ assertEquals(2, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
+ assertEquals(2, notebookRepo.revisionHistory(TEST_NOTE_ID2,
TEST_NOTE_PATH2, null).size());
}
@Test
public void addCheckpointTest() throws IOException, GitAPIException {
// initial checks
notebookRepo = new GitNotebookRepo(conf);
- assertThat(notebookRepo.list(null)).isNotEmpty();
- assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID)).isTrue();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null)).isEmpty();
+ assertFalse(notebookRepo.list(null).isEmpty());
+ assertTrue(containsNote(notebookRepo.list(null), TEST_NOTE_ID));
+ assertTrue(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).isEmpty());
notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "first commit",
null);
List<Revision> notebookHistoryBefore =
notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH, null);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null)).isNotEmpty();
+ assertFalse(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).isEmpty());
int initialCount = notebookHistoryBefore.size();
// add changes to note
@@ -197,7 +199,7 @@ public class GitNotebookRepoTest {
// see if commit is added
List<Revision> notebookHistoryAfter =
notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH, null);
- assertThat(notebookHistoryAfter.size()).isEqualTo(initialCount + 1);
+ assertEquals(initialCount + 1, notebookHistoryAfter.size());
int revCountBefore = 0;
Iterable<RevCommit> revCommits = notebookRepo.getGit().log().call();
@@ -224,7 +226,7 @@ public class GitNotebookRepoTest {
for (RevCommit revCommit : revCommits) {
revCountAfter++;
}
- assertThat(revCountAfter).isEqualTo(revCountBefore);
+ assertEquals(revCountBefore, revCountAfter);
}
private boolean containsNote(Map<String, NoteInfo> notes, String noteId) {
@@ -240,13 +242,13 @@ public class GitNotebookRepoTest {
public void getRevisionTest() throws IOException {
// initial checks
notebookRepo = new GitNotebookRepo(conf);
- assertThat(notebookRepo.list(null)).isNotEmpty();
- assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID)).isTrue();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null)).isEmpty();
+ assertFalse(notebookRepo.list(null).isEmpty());
+ assertTrue(containsNote(notebookRepo.list(null), TEST_NOTE_ID));
+ assertTrue(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).isEmpty());
// add first checkpoint
Revision revision_1 = notebookRepo.checkpoint(TEST_NOTE_ID,
TEST_NOTE_PATH, "first commit", null);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(1);
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
int paragraphCount_1 = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH,
null).getParagraphs().size();
// add paragraph and save
@@ -261,18 +263,18 @@ public class GitNotebookRepoTest {
// second checkpoint
notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "second commit",
null);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(2);
+ assertEquals(2, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
int paragraphCount_2 = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH,
null).getParagraphs().size();
- assertThat(paragraphCount_2).isEqualTo(paragraphCount_1 + 1);
+ assertEquals(paragraphCount_1 + 1, paragraphCount_2);
// get note from revision 1
Note noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH,
revision_1.id, null);
-
assertThat(noteRevision_1.getParagraphs().size()).isEqualTo(paragraphCount_1);
+ assertEquals(paragraphCount_1, noteRevision_1.getParagraphs().size());
// get current note
note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
note.setInterpreterFactory(mock(InterpreterFactory.class));
- assertThat(note.getParagraphs().size()).isEqualTo(paragraphCount_2);
+ assertEquals(paragraphCount_2, note.getParagraphs().size());
// add one more paragraph and save
Paragraph p2 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
@@ -283,34 +285,34 @@ public class GitNotebookRepoTest {
note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
note.setInterpreterFactory(mock(InterpreterFactory.class));
int paragraphCount_3 = note.getParagraphs().size();
- assertThat(paragraphCount_3).isEqualTo(paragraphCount_2 + 1);
+ assertEquals(paragraphCount_2 + 1, paragraphCount_3);
// get revision 1 again
noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH,
revision_1.id, null);
-
assertThat(noteRevision_1.getParagraphs().size()).isEqualTo(paragraphCount_1);
+ assertEquals(paragraphCount_1, noteRevision_1.getParagraphs().size());
// check that note is unchanged
note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
- assertThat(note.getParagraphs().size()).isEqualTo(paragraphCount_3);
+ assertEquals(paragraphCount_3, note.getParagraphs().size());
}
@Test
public void getRevisionFailTest() throws IOException {
// initial checks
notebookRepo = new GitNotebookRepo(conf);
- assertThat(notebookRepo.list(null)).isNotEmpty();
- assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID)).isTrue();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null)).isEmpty();
+ assertFalse(notebookRepo.list(null).isEmpty());
+ assertTrue(containsNote(notebookRepo.list(null), TEST_NOTE_ID));
+ assertTrue(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).isEmpty());
// add first checkpoint
Revision revision_1 = notebookRepo.checkpoint(TEST_NOTE_ID,
TEST_NOTE_PATH, "first commit", null);
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(1);
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
int paragraphCount_1 = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH,
null).getParagraphs().size();
// get current note
Note note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
note.setInterpreterFactory(mock(InterpreterFactory.class));
- assertThat(note.getParagraphs().size()).isEqualTo(paragraphCount_1);
+ assertEquals(paragraphCount_1, note.getParagraphs().size());
// add one more paragraph and save
Paragraph p1 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
@@ -323,26 +325,26 @@ public class GitNotebookRepoTest {
// get note from revision 1
Note noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH,
revision_1.id, null);
-
assertThat(noteRevision_1.getParagraphs().size()).isEqualTo(paragraphCount_1);
+ assertEquals(paragraphCount_1, noteRevision_1.getParagraphs().size());
// get current note
note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
note.setInterpreterFactory(mock(InterpreterFactory.class));
- assertThat(note.getParagraphs().size()).isEqualTo(paragraphCount_2);
+ assertEquals(paragraphCount_2, note.getParagraphs().size());
// test for absent revision
Revision absentRevision = new Revision("absentId", StringUtils.EMPTY, 0);
note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, absentRevision.id,
null);
- assertThat(note).isNull();
+ assertNull(note);
}
@Test
public void setRevisionTest() throws IOException {
//create repo and check that note doesn't contain revisions
notebookRepo = new GitNotebookRepo(conf);
- assertThat(notebookRepo.list(null)).isNotEmpty();
- assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID)).isTrue();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null)).isEmpty();
+ assertFalse(notebookRepo.list(null).isEmpty());
+ assertTrue(containsNote(notebookRepo.list(null), TEST_NOTE_ID));
+ assertTrue(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).isEmpty());
// get current note
Note note = notebookRepo.get(TEST_NOTE_ID, TEST_NOTE_PATH, null);
@@ -353,8 +355,8 @@ public class GitNotebookRepoTest {
// checkpoint revision1
Revision revision1 = notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH,
"set revision: first commit", null);
//TODO(khalid): change to EMPTY after rebase
- assertThat(revision1).isNotNull();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(1);
+ assertNotNull(revision1);
+ assertEquals(1, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
// add one more paragraph and save
Paragraph p1 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
@@ -364,37 +366,37 @@ public class GitNotebookRepoTest {
p1.setText("set revision sample text");
notebookRepo.save(note, null);
int paragraphCount_2 = note.getParagraphs().size();
- assertThat(paragraphCount_2).isEqualTo(paragraphCount_1 + 1);
+ assertEquals(paragraphCount_1 + 1, paragraphCount_2);
LOG.info("paragraph count after modification: {}", paragraphCount_2);
// checkpoint revision2
Revision revision2 = notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH,
"set revision: second commit", null);
//TODO(khalid): change to EMPTY after rebase
- assertThat(revision2).isNotNull();
- assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size()).isEqualTo(2);
+ assertNotNull(revision2);
+ assertEquals(2, notebookRepo.revisionHistory(TEST_NOTE_ID, TEST_NOTE_PATH,
null).size());
// set note to revision1
Note returnedNote = notebookRepo.setNoteRevision(note.getId(),
note.getPath(), revision1.id, null);
- assertThat(returnedNote).isNotNull();
-
assertThat(returnedNote.getParagraphs().size()).isEqualTo(paragraphCount_1);
+ assertNotNull(returnedNote);
+ assertEquals(paragraphCount_1, returnedNote.getParagraphs().size());
// check note from repo
Note updatedNote = notebookRepo.get(note.getId(), note.getPath(), null);
- assertThat(updatedNote).isNotNull();
- assertThat(updatedNote.getParagraphs().size()).isEqualTo(paragraphCount_1);
+ assertNotNull(updatedNote);
+ assertEquals(paragraphCount_1, updatedNote.getParagraphs().size());
// set back to revision2
returnedNote = notebookRepo.setNoteRevision(note.getId(), note.getPath(),
revision2.id, null);
- assertThat(returnedNote).isNotNull();
-
assertThat(returnedNote.getParagraphs().size()).isEqualTo(paragraphCount_2);
+ assertNotNull(returnedNote);
+ assertEquals(paragraphCount_2, returnedNote.getParagraphs().size());
// check note from repo
updatedNote = notebookRepo.get(note.getId(), note.getPath(), null);
- assertThat(updatedNote).isNotNull();
- assertThat(updatedNote.getParagraphs().size()).isEqualTo(paragraphCount_2);
+ assertNotNull(updatedNote);
+ assertEquals(paragraphCount_2, updatedNote.getParagraphs().size());
// try failure case - set to invalid revision
returnedNote = notebookRepo.setNoteRevision(note.getId(), note.getPath(),
"nonexistent_id", null);
- assertThat(returnedNote).isNull();
+ assertNull(returnedNote);
}
}
diff --git
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
index c645919..18ed8b6 100644
---
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
+++
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
@@ -17,7 +17,6 @@
package org.apache.zeppelin.notebook.repo;
-import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -307,13 +306,13 @@ public class NotebookRepoSyncTest {
Notebook vNotebookSync = new Notebook(vConf,
mock(AuthorizationService.class), vRepoSync, new NoteManager(vRepoSync, conf),
factory, interpreterSettingManager, credentials, null);
// one git versioned storage initialized
- assertThat(vRepoSync.getRepoCount()).isEqualTo(1);
- assertThat(vRepoSync.getRepo(0)).isInstanceOf(GitNotebookRepo.class);
+ assertEquals(1, vRepoSync.getRepoCount());
+ assertTrue(vRepoSync.getRepo(0) instanceof GitNotebookRepo);
GitNotebookRepo gitRepo = (GitNotebookRepo) vRepoSync.getRepo(0);
// no notes
- assertThat(vRepoSync.list(anonymous).size()).isEqualTo(0);
+ assertEquals(0, vRepoSync.list(anonymous).size());
// create note
String noteIdTmp = vNotebookSync.createNote("/test", "test", anonymous);
System.out.println(noteIdTmp);
@@ -321,15 +320,16 @@ public class NotebookRepoSyncTest {
noteTmp -> {
return noteTmp;
});
- assertThat(vRepoSync.list(anonymous).size()).isEqualTo(1);
+ assertEquals(1, vRepoSync.list(anonymous).size());
System.out.println(note);
+
NoteInfo noteInfo = vRepoSync.list(anonymous).values().iterator().next();
String noteId = noteInfo.getId();
String notePath = noteInfo.getPath();
// first checkpoint
vRepoSync.checkpoint(noteId, notePath, "checkpoint message", anonymous);
int vCount = gitRepo.revisionHistory(noteId, notePath, anonymous).size();
- assertThat(vCount).isEqualTo(1);
+ assertEquals(1, vCount);
note.setInterpreterFactory(mock(InterpreterFactory.class));
Paragraph p = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
@@ -341,7 +341,7 @@ public class NotebookRepoSyncTest {
// save and checkpoint again
vRepoSync.save(note, anonymous);
vRepoSync.checkpoint(noteId, notePath, "checkpoint message 2", anonymous);
- assertThat(gitRepo.revisionHistory(noteId, notePath,
anonymous).size()).isEqualTo(vCount + 1);
+ assertEquals(vCount + 1, gitRepo.revisionHistory(noteId, notePath,
anonymous).size());
notebookRepoSync.remove(note.getId(), note.getPath(), anonymous);
}
diff --git
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java
index fc14388..7f5ea61 100644
---
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java
+++
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
package org.apache.zeppelin.search;
-
-import static com.google.common.truth.Truth.assertThat;
import static org.apache.zeppelin.search.LuceneSearch.formatId;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -96,15 +99,13 @@ public class LuceneSearchTest {
List<Map<String, String>> results = noteSearchService.query("all");
// then
- assertThat(results).isNotEmpty();
- assertThat(results.size()).isEqualTo(1);
+ assertFalse(results.isEmpty());
+ assertEquals(1, results.size());
notebook.processNote(note2Id,
note2 -> {
- assertThat(results.get(0))
- .containsEntry("id", formatId(note2Id, note2.getLastParagraph()));
+ assertEquals(formatId(note2.getId(), note2.getLastParagraph()),
results.get(0).get("id"));
return null;
});
-
}
@Test
@@ -118,9 +119,9 @@ public class LuceneSearchTest {
List<Map<String, String>> results = noteSearchService.query("Notebook1");
// then
- assertThat(results).isNotEmpty();
- assertThat(results.size()).isEqualTo(1);
- assertThat(results.get(0)).containsEntry("id", note1Id);
+ assertFalse(results.isEmpty());
+ assertEquals(1, results.size());
+ assertEquals(note1Id, results.get(0).get("id"));
}
@Test
@@ -134,15 +135,15 @@ public class LuceneSearchTest {
List<Map<String, String>> results =
noteSearchService.query("testingTitleSearch");
// then
- assertThat(results).isNotEmpty();
- assertThat(results.size()).isAtLeast(1);
+ assertFalse(results.isEmpty());
+ assertTrue(results.size() >= 1);
int TitleHits = 0;
for (Map<String, String> res : results) {
if (res.get("header").contains("testingTitleSearch")) {
TitleHits++;
}
}
- assertThat(TitleHits).isAtLeast(1);
+ assertTrue(TitleHits >= 1);
}
@Test
@@ -155,12 +156,10 @@ public class LuceneSearchTest {
// then
notebook.processNote(note1Id,
note1 -> {
- assertThat(id.split("/")).asList() // key structure
<noteId>/paragraph/<paragraphId>
- .containsAllOf(
- note1Id, "paragraph", note1.getLastParagraph().getId()); //
LuceneSearch.PARAGRAPH
+ assertArrayEquals(id.split("/"), // key structure
<noteId>/paragraph/<paragraphId>
+ new String[]{note1.getId(), "paragraph",
note1.getLastParagraph().getId()}); // LuceneSearch.PARAGRAPH
return null;
});
-
}
@Test // (expected=IllegalStateException.class)
@@ -169,7 +168,7 @@ public class LuceneSearchTest {
// when
List<Map<String, String>> result = noteSearchService.query("anything");
// then
- assertThat(result).isEmpty();
+ assertTrue(result.isEmpty());
// assert logs were printed
// "ERROR org.apache.zeppelin.search.SearchService:97 - Failed to open
index dir RAMDirectory"
}
@@ -193,10 +192,10 @@ public class LuceneSearchTest {
// then
List<Map<String, String>> results = noteSearchService.query("all");
- assertThat(results).isEmpty();
+ assertTrue(results.isEmpty());
results = noteSearchService.query("indeed");
- assertThat(results).isNotEmpty();
+ assertFalse(results.isEmpty());
}
@Test
@@ -214,18 +213,18 @@ public class LuceneSearchTest {
String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test
at all");
drainSearchEvents();
- assertThat(resultForQuery("Notebook2")).isNotEmpty();
+ assertFalse(resultForQuery("Notebook2").isEmpty());
// when
noteSearchService.deleteNoteIndex(note2Id);
// then
- assertThat(noteSearchService.query("all")).isEmpty();
- assertThat(resultForQuery("Notebook2")).isEmpty();
+ assertTrue(noteSearchService.query("all").isEmpty());
+ assertTrue(resultForQuery("Notebook2").isEmpty());
List<Map<String, String>> results = resultForQuery("test");
- assertThat(results).isNotEmpty();
- assertThat(results.size()).isEqualTo(1);
+ assertFalse(results.isEmpty());
+ assertEquals(1, results.size());
}
@Test
@@ -235,7 +234,7 @@ public class LuceneSearchTest {
String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test
at all");
drainSearchEvents();
- assertThat(resultForQuery("test").size()).isEqualTo(3);
+ assertEquals(3, resultForQuery("test").size());
// when
notebook.processNote(note1Id,
@@ -249,15 +248,15 @@ public class LuceneSearchTest {
drainSearchEvents();
// then
- assertThat(resultForQuery("Notebook1").size()).isEqualTo(1);
+ assertEquals(1, resultForQuery("Notebook1").size());
List<Map<String, String>> results = resultForQuery("test");
- assertThat(results).isNotEmpty();
- assertThat(results.size()).isEqualTo(2);
+ assertFalse(results.isEmpty());
+ assertEquals(2, results.size());
// does not include Notebook1's paragraph any more
for (Map<String, String> result : results) {
- assertThat(result.get("id").startsWith(note1Id)).isFalse();
+ assertFalse(result.get("id").startsWith(note1Id));
}
}
@@ -267,7 +266,7 @@ public class LuceneSearchTest {
String note1Id = newNoteWithParagraph("Notebook1", "test");
String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test
at all");
drainSearchEvents();
- assertThat(resultForQuery("test").size()).isEqualTo(3);
+ assertEquals(3, resultForQuery("test").size());
// when
// use write lock, because name is overwritten
@@ -280,9 +279,9 @@ public class LuceneSearchTest {
drainSearchEvents();
Thread.sleep(1000);
// then
- assertThat(resultForQuery("Notebook1")).isEmpty();
- assertThat(resultForQuery("NotebookN")).isNotEmpty();
- assertThat(resultForQuery("NotebookN").size()).isEqualTo(1);
+ assertTrue(resultForQuery("Notebook1").isEmpty());
+ assertFalse(resultForQuery("NotebookN").isEmpty());
+ assertEquals(1, resultForQuery("NotebookN").size());
}
private List<Map<String, String>> resultForQuery(String q) {