use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class DatabaseMetadataTest method shouldReturnToString2.
@Test
public void shouldReturnToString2() {
Database database = Mockito.mock(Database.class);
Mockito.when(database.value()).thenReturn(DatabaseType.COLUMN);
DatabaseMetadata metadata = DatabaseMetadata.of(database);
assertEquals("COLUMN", metadata.toString());
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class DatabaseMetadataTest method shouldReturnToString.
@Test
public void shouldReturnToString() {
Database database = Mockito.mock(Database.class);
Mockito.when(database.value()).thenReturn(DatabaseType.COLUMN);
Mockito.when(database.provider()).thenReturn("column");
DatabaseMetadata metadata = DatabaseMetadata.of(database);
assertEquals("COLUMN@column", metadata.toString());
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class DatabaseMetadataTest method shouldReturnMetadata.
@Test
public void shouldReturnMetadata() {
Database database = Mockito.mock(Database.class);
Mockito.when(database.value()).thenReturn(DatabaseType.COLUMN);
Mockito.when(database.provider()).thenReturn("column");
DatabaseMetadata metadata = DatabaseMetadata.of(database);
assertEquals(DatabaseType.COLUMN, metadata.getType());
assertEquals("column", metadata.getProvider());
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class GraphProducer method getGraphMock.
@Produces
@ApplicationScoped
@Database(value = DatabaseType.GRAPH, provider = "graphRepositoryMock")
public Graph getGraphMock() {
Graph graphMock = mock(Graph.class);
Vertex vertex = mock(Vertex.class);
when(vertex.label()).thenReturn("Person");
when(vertex.id()).thenReturn(10L);
when(graphMock.vertices(10L)).thenReturn(Collections.<Vertex>emptyList().iterator());
when(vertex.keys()).thenReturn(singleton("name"));
when(vertex.value("name")).thenReturn("nameMock");
when(graphMock.addVertex(Mockito.anyString())).thenReturn(vertex);
return graphMock;
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class MockProducer method getBucketManagerMock.
@Produces
@Database(value = DatabaseType.KEY_VALUE, provider = "keyvalueMock")
public BucketManager getBucketManagerMock() {
BucketManager bucketManager = Mockito.mock(BucketManager.class);
Person person = Person.builder().withName("keyvalueMock").build();
when(bucketManager.get("key")).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get(10L)).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get("user")).thenReturn(Optional.of(Value.of(new User("keyvalueMock", "keyvalueMock", 10))));
return bucketManager;
}
Aggregations