<commit_before>package age;

import java.nio.file.Path;

import org.junit.Assert;
import org.junit.Test;

import age.api.SkillFile;
import common.CommonTest;
import de.ust.skill.common.java.api.SkillFile.Mode;

/**
 * Make some instances and delete them aftewards.
 * 
 * @author <NAME>
 */
@SuppressWarnings("static-method")
public class SimpleDelete extends CommonTest {

    private static final SkillFile open(String name) throws Exception {
        return SkillFile.open(tmpFile(name), Mode.Create, Mode.Write);
    }

    private static final SkillFile read(Path path) throws Exception {
        return SkillFile.open(path, Mode.Read, Mode.ReadOnly);
    }

    @Test
    public void writeDelete() throws Exception {
        final int count = 100;

        SkillFile sf = open("writeDelete");
        for (int i = 0; i < count; i++)
            sf.Ages().make(i);

        sf.flush();

        Assert.assertEquals("check size", count, read(sf.currentPath()).Ages().size());

        // delete all instances
        for (Age a : sf.Ages())
            a.delete();

        sf.close();

        Assert.assertEquals("ensure that no instance remains", 0, read(sf.currentPath()).Ages().size());
    }

}<commit_msg>added a second delete test<commit_after>package age;

import java.nio.file.Path;

import org.junit.Assert;
import org.junit.Test;

import age.api.SkillFile;
import common.CommonTest;
import de.ust.skill.common.java.api.SkillFile.Mode;

/**
 * Make some instances and delete them afterwards.
 * 
 * @author <NAME>
 */
@SuppressWarnings("static-method")
public class SimpleDelete extends CommonTest {

    private static final SkillFile open(String name) throws Exception {
        return SkillFile.open(tmpFile(name), Mode.Create, Mode.Write);
    }

    private static final SkillFile read(Path path) throws Exception {
        return SkillFile.open(path, Mode.Read, Mode.ReadOnly);
    }

    @Test
    public void writeDelete() throws Exception {
        final int count = 100;

        SkillFile sf = open("writeDelete");
        for (int i = 0; i < count; i++)
            sf.Ages().make(i);

        sf.flush();

        Assert.assertEquals("check size", count, read(sf.currentPath()).Ages().size());

        // delete all instances
        for (Age a : sf.Ages())
            a.delete();

        sf.close();

        Assert.assertEquals("ensure that no instance remains", 0, read(sf.currentPath()).Ages().size());
    }

    @Test
    public void writeDeleteSome() throws Exception {
        final int count = 100;

        SkillFile sf = open("writeDelete");
        for (int i = 0; i < count; i++)
            sf.Ages().make(i);

        sf.flush();

        Assert.assertEquals("check size", count, read(sf.currentPath()).Ages().size());

        // delete all instances
        for (Age a : sf.Ages())
            if (a.getAge() < count / 10)
                a.delete();

        sf.close();

        Assert.assertEquals("ensure that no instance remains", (int) (count * .9),
                read(sf.currentPath()).Ages().size());
    }
}
{'fraction_non_alphanumeric': 0.1360078277886497, 'fraction_numerical': 0.005544683626875407, 'mean_word_length': 2.570430733410943, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1348365', 'n_tokens_mistral': 925, 'n_tokens_neox': 882, 'n_words': 242}