// Path: src/main/java/de/waldheinz/fs/ReadOnlyException.java
// public final class ReadOnlyException extends RuntimeException {
// 
//     private final static long serialVersionUID = 1;
//     
//     /**
//      * Creates a new instance of {@code ReadOnlyException}.
//      *
//      */
//     public ReadOnlyException() {
//         super("read-only");
//     }
// }


import de.waldheinz.fs.ReadOnlyException;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/*
 * Copyright (C) 2009-2013 Matthias Treydte <mt@waldheinz.de>
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; If not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package de.waldheinz.fs.util;


/**
 *
 * @author Matthias Treydte &lt;matthias.treydte at meetwise.com&gt;
 */
public class FileDiskTest {

    private final static int SIZE = 1024 * 1024;
    private FileDisk fd;
    private File f;
    
    @Before
    public void setUp() throws Exception {
        f = File.createTempFile("fileDiskTest", ".tmp");
        f.deleteOnExit();
        fd = FileDisk.create(f, SIZE);
    }

    @After
    public void tearDown() throws IOException {
        fd.close();
        f.delete();
    }
    
// Path: src/main/java/de/waldheinz/fs/ReadOnlyException.java
// public final class ReadOnlyException extends RuntimeException {
// 
//     private final static long serialVersionUID = 1;
//     
//     /**
//      * Creates a new instance of {@code ReadOnlyException}.
//      *
//      */
//     public ReadOnlyException() {
//         super("read-only");
//     }
// }


// Path: src/test/java/de/waldheinz/fs/util/FileDiskTest.java
import de.waldheinz.fs.ReadOnlyException;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/*
 * Copyright (C) 2009-2013 Matthias Treydte <mt@waldheinz.de>
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; If not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package de.waldheinz.fs.util;


/**
 *
 * @author Matthias Treydte &lt;matthias.treydte at meetwise.com&gt;
 */
public class FileDiskTest {

    private final static int SIZE = 1024 * 1024;
    private FileDisk fd;
    private File f;
    
    @Before
    public void setUp() throws Exception {
        f = File.createTempFile("fileDiskTest", ".tmp");
        f.deleteOnExit();
        fd = FileDisk.create(f, SIZE);
    }

    @After
    public void tearDown() throws IOException {
        fd.close();
        f.delete();
    }
    
    @Test(expected=ReadOnlyException.class)