<commit_before>/*
 *  jETeL/Clover - Java based ETL application framework.
 *  Created on Apr 10, 2003
 *  Copyright (C) 2003, 2002  <NAME>, <NAME>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.jetel.data;

import org.jetel.metadata.DataFieldMetadata;

import junit.framework.TestCase;

/**
 * @author maciorowski
 *
 */
public class ByteDataFieldTest  extends TestCase {
//TODO implement ByteDataFieldTest
    byte[] byteArray=new byte[]{0x01,0x02,0x03,0x04,0x05,0x40};
    Byte[] ByteArray=new Byte[byteArray.length+1];
    
    ByteDataField byteField;
    
    static final String TEST_STRING="THIS is test !@#$%^&*()ěščřžýíé";
    
protected void setUp() {
    int i=0;
    for(byte b: byteArray){
        ByteArray[i++]=new Byte(b);
    }
    ByteArray[byteArray.length]=0x41;
    
    byteField=new ByteDataField(new DataFieldMetadata("byte",DataFieldMetadata.BYTE_FIELD,(short)10));
}

protected void tearDown() {

}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.ByteDataField(DataFieldMetadata _metadata)
	 *
	 */
	public void test_1_ByteDataField() {
        byteField.setValue(byteArray);
        assertEquals(byteArray, byteField.getByteArray());
        byteField.fromString(TEST_STRING,"UTF-8");
        assertEquals(TEST_STRING, byteField.toString("UTF-8"));
	}


	/**
	 *  Test for @link org.jetel.data.ByteDataField.ByteDataField(DataFieldMetadata _metadata, byte[] value)
	 *
	 */
	public void test_2_ByteDataField() {
        byteField.setValue(ByteArray);
        System.out.println(byteField.toString());
        
	}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.setValue(Object _value)
	 *
	 */
	public void test_1_setValue() {
        
	}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.setValue(byte[] value)
	 *
	 */
	public void test_2_setValue() {
	}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.setValue(byte value)
	 *
	 */
	public void test_setValue() {<commit_msg>rearranged tests<commit_after>/*
 *  jETeL/Clover - Java based ETL application framework.
 *  Created on Apr 10, 2003
 *  Copyright (C) 2003, 2002  <NAME>, <NAME>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.jetel.data;

import org.jetel.metadata.DataFieldMetadata;

import junit.framework.TestCase;

/**
 * @author maciorowski
 *
 */
public class ByteDataFieldTest  extends TestCase {
//TODO implement ByteDataFieldTest
    byte[] byteArray=new byte[]{0x01,0x02,0x03,0x04,0x05,0x40};
    Byte[] ByteArray=new Byte[byteArray.length+1];
    
    ByteDataField byteField;
    
    static final String TEST_STRING="THIS is test !@#$%^&*()ěščřžýíé";
    
protected void setUp() {
    int i=0;
    for(byte b: byteArray){
        ByteArray[i++]=new Byte(b);
    }
    ByteArray[byteArray.length]=0x41;
    
    byteField=new ByteDataField(new DataFieldMetadata("byte",DataFieldMetadata.BYTE_FIELD,(short)10));
}

protected void tearDown() {

}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.ByteDataField(DataFieldMetadata _metadata)
	 *
	 */
	public void test_1_setValue() {
        byteField.setValue(byteArray);
        assertEquals(byteArray, byteField.getByteArray());
        byteField.fromString(TEST_STRING,"UTF-8");
        assertEquals(TEST_STRING, byteField.toString("UTF-8"));
	}


	/**
	 *  Test for @link org.jetel.data.ByteDataField.ByteDataField(DataFieldMetadata _metadata, byte[] value)
	 *
	 */
	public void test_2_setValue() {
        byteField.setValue(ByteArray);
        System.out.println(byteField.toString());
        
	}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.setValue(Object _value)
	 *
	 */
	public void test_3_setValue() {
        byteField.setValue((Object)byteArray);
        assertEquals(byteArray,byteField.getValue());
	}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.setValue(byte[] value)
	 *
	 */
	public void test_4_setValue() {
	}

	/**
	 *  Test for @link org.jetel.data.ByteDataField.setValue(byte value)
	 *
	 */
	public void test_setValue() {
{'fraction_non_alphanumeric': 0.11040299906279288, 'fraction_numerical': 0.022492970946579195, 'mean_word_length': 3.549019607843137, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1887532', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1668, 'n_words': 461}