@Test @DisplayName("Creates an empty database") public void testCreate(@Mock Storage storage, @Mock FileStructure fileStructure, @Mock RecordStructure recordStructure) throws Exception { DefaultDatabaseAccessor accessor = new DefaultDatabaseAccessor("x.y", "myDb", storage, extraAttributes("custom", "myValue"), fileStructure, recordStructure); accessor.createDatabase(); ArgumentCaptor<Map<String, String>> actualAtts = ArgumentCaptor.forClass(Map.class); verify(fileStructure).initializeStorage(eq(storage), actualAtts.capture(), eq("version")); assertThat(actualAtts.getValue()).containsOnly( entry("version", "x.y"), entry("name", "myDb"), entry("charset", Charset.defaultCharset().name()), entry("custom", "myValue") ); }
public void createDatabase() throws StorageExistsException { this.fileStructure.initializeStorage(storage, attributes, ATTRIBUTE_VERSION); }
DefaultDatabaseAccessor implements DatabaseAccessor { public void createDatabase() throws StorageExistsException { this.fileStructure.initializeStorage(storage, attributes, ATTRIBUTE_VERSION); } }
DefaultDatabaseAccessor implements DatabaseAccessor { public void createDatabase() throws StorageExistsException { this.fileStructure.initializeStorage(storage, attributes, ATTRIBUTE_VERSION); } 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 { public void createDatabase() throws StorageExistsException { this.fileStructure.initializeStorage(storage, attributes, ATTRIBUTE_VERSION); } 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 { public void createDatabase() throws StorageExistsException { this.fileStructure.initializeStorage(storage, attributes, ATTRIBUTE_VERSION); } 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();  }