Skip to content

Commit

Permalink
Merge pull request #369 from OpenHFT/issue/354
Browse files Browse the repository at this point in the history
Add reproducing tests, Fix #354
  • Loading branch information
minborg authored Jan 4, 2022
2 parents 8e694e7 + 64798e7 commit c489d5e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/java/net/openhft/chronicle/map/Issue354Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.openhft.chronicle.map;

import net.openhft.chronicle.core.values.LongValue;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

public class Issue354Test {

@Test
public void reproduce() throws IOException {

final File file = new File("/tmp/issue354-map");

final ChronicleMapBuilder<LongValue, LongValue> builder = ChronicleMapBuilder.of(LongValue.class, LongValue.class)
.entries(5);

try (ChronicleMap<LongValue, LongValue> map = builder.createOrRecoverPersistedTo(file)) {

};


}

}
30 changes: 30 additions & 0 deletions src/test/java/net/openhft/chronicle/map/Issue354bTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.openhft.chronicle.map;

import net.openhft.chronicle.core.values.LongValue;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.io.IOException;

import static org.junit.Assert.assertTrue;

public class Issue354bTest {

@Rule
public TemporaryFolder testFolder = new TemporaryFolder();

@Test
public void build_toFile() throws IOException {
String baseDirectory = testFolder.getRoot().toString();
File file = new File(baseDirectory, "chronicle.dat");
ChronicleMap<LongValue, LongValue> map = ChronicleMapBuilder.of(LongValue.class, LongValue.class)
.name("test")
.entries(5)
.createOrRecoverPersistedTo(file, true);

assertTrue(file.isFile());
}

}

0 comments on commit c489d5e

Please sign in to comment.