Use TemporaryFolder for tests
This commit is contained in:
@@ -4,14 +4,19 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
public class DataFileTest
|
public class DataFileTest
|
||||||
{
|
{
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder folder = new TemporaryFolder();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test1() throws IOException
|
public void test1() throws IOException
|
||||||
{
|
{
|
||||||
File file = new File("d:/rs/07/test/test.dat");
|
File file = folder.newFile();
|
||||||
Store store = new Store();
|
Store store = new Store();
|
||||||
DataFile df = new DataFile(store, 42, file);
|
DataFile df = new DataFile(store, 42, file);
|
||||||
int sector = df.write(3, ByteBuffer.wrap("test".getBytes()));
|
int sector = df.write(3, ByteBuffer.wrap("test".getBytes()));
|
||||||
@@ -27,7 +32,7 @@ public class DataFileTest
|
|||||||
byte[] b = new byte[1024];
|
byte[] b = new byte[1024];
|
||||||
for (int i = 0; i < 1024; ++i) b[i] = (byte) i;
|
for (int i = 0; i < 1024; ++i) b[i] = (byte) i;
|
||||||
|
|
||||||
File file = new File("d:/rs/07/test/test.dat");
|
File file = folder.newFile();
|
||||||
Store store = new Store();
|
Store store = new Store();
|
||||||
DataFile df = new DataFile(store, 42, file);
|
DataFile df = new DataFile(store, 42, file);
|
||||||
int sector = df.write(0x1FFFF, ByteBuffer.wrap(b));
|
int sector = df.write(0x1FFFF, ByteBuffer.wrap(b));
|
||||||
|
|||||||
@@ -3,14 +3,19 @@ package net.runelite.cache.fs;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
public class IndexFileTest
|
public class IndexFileTest
|
||||||
{
|
{
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder folder = new TemporaryFolder();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test1() throws IOException
|
public void test1() throws IOException
|
||||||
{
|
{
|
||||||
File file = new File("d:/rs/07/test/test.dat");
|
File file = folder.newFile();
|
||||||
Store store = new Store();
|
Store store = new Store();
|
||||||
IndexFile index = new IndexFile(store, 5, file);
|
IndexFile index = new IndexFile(store, 5, file);
|
||||||
IndexEntry entry = new IndexEntry(index, 7, 8, 9);
|
IndexEntry entry = new IndexEntry(index, 7, 8, 9);
|
||||||
|
|||||||
Reference in New Issue
Block a user