Skip to content

Commit

Permalink
test: remove public the test methods
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Nov 19, 2023
1 parent f19652c commit ea0ab7b
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,28 @@ public class ArangoDBDocumentManagerTest {
private final String KEY_NAME = "_key";

@BeforeEach
public void setUp() {
void setUp() {
random = new Random();
entityManager = DocumentDatabase.INSTANCE.get().apply(DATABASE);
entityManager.delete(DocumentDeleteQuery.delete().from(COLLECTION_NAME).build());

}

@AfterEach
public void after() {
void after() {
entityManager.delete(DocumentDeleteQuery.delete().from(COLLECTION_NAME).build());
}

@Test
public void shouldSave() {
void shouldSave() {
DocumentEntity entity = getEntity();

DocumentEntity documentEntity = entityManager.insert(entity);
assertTrue(documentEntity.documents().stream().map(Document::name).anyMatch(s -> s.equals(KEY_NAME)));
}

@Test
public void shouldUpdateSave() {
void shouldUpdateSave() {
DocumentEntity entity = getEntity();
entityManager.insert(entity);
Document newField = Documents.of("newField", "10");
Expand All @@ -88,7 +88,7 @@ public void shouldUpdateSave() {
}

@Test
public void shouldRemoveEntity() {
void shouldRemoveEntity() {
DocumentEntity documentEntity = entityManager.insert(getEntity());
Document id = documentEntity.find("_key").get();
DocumentQuery select = select().from(COLLECTION_NAME).where(id.name()).eq(id.get()).build();
Expand All @@ -98,7 +98,7 @@ public void shouldRemoveEntity() {
}

@Test
public void shouldRemoveEntity2() {
void shouldRemoveEntity2() {
DocumentEntity documentEntity = entityManager.insert(getEntity());
Document id = documentEntity.find("name").get();
DocumentQuery select = select().from(COLLECTION_NAME).where(id.name()).eq(id.get()).build();
Expand All @@ -109,7 +109,7 @@ public void shouldRemoveEntity2() {


@Test
public void shouldFindDocument() {
void shouldFindDocument() {
DocumentEntity entity = entityManager.insert(getEntity());
Document id = entity.find(KEY_NAME).get();
DocumentQuery query = select().from(COLLECTION_NAME).where(id.name()).eq(id.get()).build();
Expand All @@ -124,7 +124,7 @@ public void shouldFindDocument() {


@Test
public void shouldSaveSubDocument() {
void shouldSaveSubDocument() {
DocumentEntity entity = getEntity();
entity.add(Document.of("phones", Document.of("mobile", "1231231")));
DocumentEntity entitySaved = entityManager.insert(entity);
Expand All @@ -138,7 +138,7 @@ public void shouldSaveSubDocument() {
}

@Test
public void shouldSaveSubDocument2() {
void shouldSaveSubDocument2() {
DocumentEntity entity = getEntity();
entity.add(Document.of("phones", Arrays.asList(Document.of("mobile", "1231231"), Document.of("mobile2", "1231231"))));
DocumentEntity entitySaved = entityManager.insert(entity);
Expand All @@ -154,14 +154,14 @@ public void shouldSaveSubDocument2() {


@Test
public void shouldConvertFromListSubdocumentList() {
void shouldConvertFromListSubdocumentList() {
DocumentEntity entity = createSubdocumentList();
entityManager.insert(entity);

}

@Test
public void shouldRetrieveListSubdocumentList() {
void shouldRetrieveListSubdocumentList() {
DocumentEntity entity = entityManager.insert(createSubdocumentList());
Document key = entity.find(KEY_NAME).get();
DocumentQuery query = select().from("AppointmentBook").where(key.name()).eq(key.get()).build();
Expand All @@ -176,7 +176,7 @@ public void shouldRetrieveListSubdocumentList() {
}

@Test
public void shouldRunAQL() {
void shouldRunAQL() {
DocumentEntity entity = getEntity();
DocumentEntity entitySaved = entityManager.insert(entity);

Expand All @@ -188,15 +188,15 @@ public void shouldRunAQL() {


@Test
public void shouldCount() {
void shouldCount() {
DocumentEntity entity = getEntity();
entityManager.insert(entity);

assertTrue(entityManager.count(COLLECTION_NAME) > 0);
}

@Test
public void shouldReadFromDifferentBaseDocumentUsingInstance() {
void shouldReadFromDifferentBaseDocumentUsingInstance() {
entityManager.insert(getEntity());
ArangoDB arangoDB = DefaultArangoDBDocumentManager.class.cast(entityManager).getArangoDB();
arangoDB.db(DATABASE).collection(COLLECTION_NAME).insertDocument(new Person());
Expand All @@ -206,7 +206,7 @@ public void shouldReadFromDifferentBaseDocumentUsingInstance() {
}

@Test
public void shouldReadFromDifferentBaseDocumentUsingMap() {
void shouldReadFromDifferentBaseDocumentUsingMap() {
entityManager.insert(getEntity());
ArangoDB arangoDB = DefaultArangoDBDocumentManager.class.cast(entityManager).getArangoDB();
Map<String, Object> map = new HashMap<>();
Expand All @@ -219,7 +219,7 @@ public void shouldReadFromDifferentBaseDocumentUsingMap() {
}

@Test
public void shouldExecuteAQLWithTypeParams() {
void shouldExecuteAQLWithTypeParams() {
entityManager.insert(getEntity());
String aql = "FOR a IN person FILTER a.name == @name RETURN a.name";
List<String> entities = entityManager.aql(aql,
Expand All @@ -229,15 +229,15 @@ public void shouldExecuteAQLWithTypeParams() {
}

@Test
public void shouldExecuteAQLWithType() {
void shouldExecuteAQLWithType() {
entityManager.insert(getEntity());
String aql = "FOR a IN person RETURN a.name";
List<String> entities = entityManager.aql(aql, String.class).collect(Collectors.toList());
assertFalse(entities.isEmpty());
}

@Test
public void shouldDeleteAll() {
void shouldDeleteAll() {
for (int index = 0; index < 20; index++) {
DocumentEntity entity = getEntity();
entityManager.insert(entity);
Expand Down

0 comments on commit ea0ab7b

Please sign in to comment.