@Test @DisplayName("Appends data") public void testAppend(@Mock Storage storage, @Mock FileStructure fileStructure, @Mock RecordStructure recordStructure) throws Exception { when(recordStructure.toData(any())).thenReturn("myData"); DefaultDatabaseAccessor accessor = new DefaultDatabaseAccessor("x.y", "myDb", storage, requiredAttributes(), fileStructure, recordStructure); Event event = event("myUser", "a1", "REPLACE", "GHI", LocalDateTime.now()); accessor.append(event); verify(recordStructure).toData(event); verify(storage).append("myData"); }
@Override public void append(Event event) { this.storage.append(recordStructure.toData(event)); }
DefaultDatabaseAccessor implements DatabaseAccessor { @Override public void append(Event event) { this.storage.append(recordStructure.toData(event)); } }
DefaultDatabaseAccessor implements DatabaseAccessor { @Override public void append(Event event) { this.storage.append(recordStructure.toData(event)); } DefaultDatabaseAccessor(String version, String databaseName, Storage storage);   DefaultDatabaseAccessor(String version, String databaseName, Storage storage, Map<String, String> attributes, FileStructure fileStructure, RecordStructure recordStructure); }
DefaultDatabaseAccessor implements DatabaseAccessor { @Override public void append(Event event) { this.storage.append(recordStructure.toData(event)); } DefaultDatabaseAccessor(String version, String databaseName, Storage storage);   DefaultDatabaseAccessor(String version, String databaseName, Storage storage, Map<String, String> attributes, FileStructure fileStructure, RecordStructure recordStructure); static DefaultDatabaseAccessor createFrom(Storage storage); @Override String getSpecVersion(); @Override String getDatabaseName(); void createDatabase(); String getAttribute(String name); @Override void append(Event event); @Override Stream<Event> getData(); }
DefaultDatabaseAccessor implements DatabaseAccessor { @Override public void append(Event event) { this.storage.append(recordStructure.toData(event)); } DefaultDatabaseAccessor(String version, String databaseName, Storage storage);   DefaultDatabaseAccessor(String version, String databaseName, Storage storage, Map<String, String> attributes, FileStructure fileStructure, RecordStructure recordStructure); static DefaultDatabaseAccessor createFrom(Storage storage); @Override String getSpecVersion(); @Override String getDatabaseName(); void createDatabase(); String getAttribute(String name); @Override void append(Event event); @Override Stream<Event> getData();  }