### Question:
VersionedDatabaseFactory implements DatabaseFactory { @VisibleForTesting DatabaseVersion getDatabaseVersion() { if (dbVersionFile.exists()) { try { final String versionValue = Files.readString(dbVersionFile.toPath()).trim(); return DatabaseVersion.fromString(versionValue) .orElseThrow( () -> new DatabaseStorageException("Unrecognized database version: " + versionValue)); } catch (IOException e) { throw new DatabaseStorageException( String.format( "Unable to read database version from file %s", dbVersionFile.getAbsolutePath()), e); } } return this.createDatabaseVersion; } VersionedDatabaseFactory(
      final MetricsSystem metricsSystem,
      final String dataPath,
      final StateStorageMode dataStorageMode,
      final Eth1Address depositContractAddress);  VersionedDatabaseFactory(
      final MetricsSystem metricsSystem,
      final String dataPath,
      final StateStorageMode dataStorageMode,
      final String createDatabaseVersion,
      final long stateStorageFrequency,
      final Eth1Address eth1Address); @Override Database createDatabase(); static final long DEFAULT_STORAGE_FREQUENCY; }### Answer:
@Test public void createDatabase_shouldAllowV4Database() { createDbDirectory(dataDir); final VersionedDatabaseFactory dbFactory = new VersionedDatabaseFactory( new StubMetricsSystem(), dataDir.toString(), DATA_STORAGE_MODE, "4", 1L, eth1Address); assertThat(dbFactory.getDatabaseVersion()).isEqualTo(DatabaseVersion.V4); }
@Test public void createDatabase_shouldAllowV3Database() { createDbDirectory(dataDir); final VersionedDatabaseFactory dbFactory = new VersionedDatabaseFactory( new StubMetricsSystem(), dataDir.toString(), DATA_STORAGE_MODE, "3.0", 1L, eth1Address); assertThat(dbFactory.getDatabaseVersion()).isEqualTo(DatabaseVersion.V3); }