<commit_before>package model;

import static org.junit.Assert.*;
import controllers.MiniProjectController;
import demonstrateur.MiniProject;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by neowutran on 22/01/14.
 */
public class EquipmentTest {

    @BeforeClass
    public static void onlyOnce() {

        try {
            final Method m = MiniProject.class.getDeclaredMethod("loadConfigFile",
                    Path.class);
            m.setAccessible(true);
            m.invoke(null, Paths.get(MiniProject.FOLDER, MiniProject.CONFIG));

        } catch (IllegalAccessException | IllegalArgumentException
                | InvocationTargetException | NoSuchMethodException
                | SecurityException e) {
            e.printStackTrace();
        }

        try {

            SaveLoad.load( SaveLoad.DATA );
        } catch( final MiniProjectException e ) {
            MiniProjectController.LOGGER.severe( java.util.Arrays.toString( e
                    .getStackTrace( ) ) );
        }
    }



    @Test
    public void testSetHealth() throws Exception {
        Health h = new Health(HealthState.OK);
        Equipment e = new Equipment("tablet", new ArrayList<Feature>(), new Health(HealthState.NOT_OK), false);
        e.setHealth(h);
        assertEquals(h, e.getHealth());
    }

    @Test
    public void testSetUnderRepair() throws Exception {
        //TODO
    }

    @Test
    public void testCheckExistence() throws Exception {
        //TODO
    }
<commit_msg>test checkexistence<commit_after>package model;

import static org.junit.Assert.*;
import config.Error;
import controllers.MiniProjectController;
import demonstrateur.MiniProject;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by neowutran on 22/01/14.
 */
public class EquipmentTest {

    @BeforeClass
    public static void onlyOnce() {

        try {
            final Method m = MiniProject.class.getDeclaredMethod("loadConfigFile",
                    Path.class);
            m.setAccessible(true);
            m.invoke(null, Paths.get(MiniProject.FOLDER, MiniProject.CONFIG));

        } catch (IllegalAccessException | IllegalArgumentException
                | InvocationTargetException | NoSuchMethodException
                | SecurityException e) {
            e.printStackTrace();
        }

        try {

            SaveLoad.load( SaveLoad.DATA );
        } catch( final MiniProjectException e ) {
            MiniProjectController.LOGGER.severe( java.util.Arrays.toString( e
                    .getStackTrace( ) ) );
        }
    }


    /**
     * @author <NAME>
     * @throws Exception
     */
    @Test
    public void testSetHealth() throws Exception {
        Health h = new Health(HealthState.OK);
        Equipment e = new Equipment("tablet", new ArrayList<Feature>(), new Health(HealthState.NOT_OK), false);
        e.setHealth(h);
        assertEquals(h, e.getHealth());
    }

    @Test
    public void testSetUnderRepair() throws Exception {
         Equipment e = new Equipment("tablet", new ArrayList<Feature>(), new Health(HealthState.NOT_OK), false);
         e.setUnderRepair(true);
         assertEquals(true, e.getUnderRepair());
    }

    @Test
    public void testCheckExistence() throws Exception {
    	 Equipment e = new Equipment("tablet", new ArrayList<Feature>(), new Health(HealthState.NOT_OK), false);
    	 Equipment second = e;
    	 try{
    	 	second.checkExistence(second.getId());
    	 }catch(InvalidParameterException ex){
    		 InvalidParameterException test = new InvalidParameterException(Error.EQUIPMENT_ALREADY_EXIST);
    		 assertEquals(ex.getMessage(), test.getMessage());
    	 }
    }

{'fraction_non_alphanumeric': 0.10325826545280306, 'fraction_numerical': 0.0028749401054144704, 'mean_word_length': 2.6784140969162995, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '7532127', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1136, 'n_words': 251}