<commit_before>package ol.format;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsonUtils;

import ol.BaseTestCase;
import ol.Coordinate;
import ol.Feature;
import ol.FeatureOptions;
import ol.OLFactory;
import ol.geom.LineString;

/**
 *
 * @author <NAME>
 *
 */
public class GeoJSONTest extends BaseTestCase {

	private GeoJSON geoJSONFormat;
	
	@Override
	protected void gwtSetUp() throws Exception {
		this.geoJSONFormat = OLFactory.createGeoJSON();
	}
	
	public void testFeatureToGeoJSON() {

		assertNotNull(this.geoJSONFormat);

		JavaScriptObject geoJSON = this.geoJSONFormat.writeFeatureObject(this.createTestFeature(), null);
		assertNotNull(geoJSON);

	}

	public void testGeoJSONToFeature() {

		JavaScriptObject geoJSON = this.geoJSONFormat.writeFeatureObject(this.createTestFeature(), null);
		
		// Convert Features from GeoJSON
		Feature featureGeoJSON = this.geoJSONFormat.readFeature(geoJSON, null);
		assertNotNull(featureGeoJSON);

	}
	
	public void testWriteGeoJSON() {
		
		String geoJSON = this.geoJSONFormat.writeFeatures(createTestFeature(), null);
		assertNotNull(geoJSON);
		
		JavaScriptObject javaScriptObject = JsonUtils.safeEval(geoJSON);
		assertNotNull(javaScriptObject);
		
	}
	
	public void testReadGeoJSON() {
		
		String geoJSON = this.geoJSONFormat.writeFeatures(createTestFeature(), null);
		assertNotNull(geoJSON);

		Feature feature = this.geoJSONFormat.readFeature(geoJSON, null);
		
		assertNotNull(feature);
		//assertTrue(features.length > 0);
		
	}
	
	private Feature createTestFeature() {
		
		Coordinate coordinate1 = OLFactory.createCoordinate(1, 1);
		Coordinate coordinate2 = OLFactory.createCoordinate(5, 5);
		Coordinate[] coordinates = { coordinate1, coordinate2 };
		LineString lineString = OLFactory.createLineString(coordinates);

		// Create feature
		FeatureOptions featureOptions = OLFactory.createOptions();
		featureOptions.setGeometry(lineString);
		return OLFactory.createFeature(featureOptions);
		
	}

}
<commit_msg>Add test for GeoJSON<commit_after>package ol.format;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsonUtils;

import ol.Coordinate;
import ol.Feature;
import ol.FeatureOptions;
import ol.GwtOL3BaseTestCase;
import ol.OLFactory;
import ol.geom.LineString;

/**
 *
 * @author <NAME>
 *
 */
public class GeoJSONTest extends GwtOL3BaseTestCase {

	private GeoJSON geoJSONFormat;
	
	
	
	@Override
	protected void gwtSetUp() throws Exception {
	    injectUrlAndTest(new TestWithInjection() {

            @Override
            public void test() {
                geoJSONFormat = OLFactory.createGeoJSON();
            }
	        
	    });
	}
	
	public void testFeatureToGeoJSON() {

	    injectUrlAndTest(new TestWithInjection() {
            
            @Override
            public void test() {
                
                assertNotNull(geoJSONFormat);

                JavaScriptObject geoJSON = geoJSONFormat.writeFeatureObject(createTestFeature(), null);
                assertNotNull(geoJSON);
                
            }
            
        });
	    
		

	}

    public void testGeoJSONToFeature() {
        
        injectUrlAndTest(new TestWithInjection() {

            @Override
            public void test() {
                JavaScriptObject geoJSON = geoJSONFormat.writeFeatureObject(createTestFeature(), null);

                // Convert Features from GeoJSON
                Feature featureGeoJSON = geoJSONFormat.readFeature(geoJSON, null);
                assertNotNull(featureGeoJSON);
            }

        });

    }
	
    public void testWriteGeoJSON() {
        
        injectUrlAndTest(new TestWithInjection() {

            @Override
            public void test() {
                String geoJSON = geoJSONFormat.writeFeatures(createTestFeature(), null);
                assertNotNull(geoJSON);

                JavaScriptObject javaScriptObject = JsonUtils.safeEval(geoJSON);
                assertNotNull(javaScriptObject);
            }
        });

    }
	
    public void testReadGeoJSON() {
        
        injectUrlAndTest(new TestWithInjection() {

            @Override
            public void test() {
                String geoJSON = geoJSONFormat.writeFeatures(createTestFeature(), null);
                assertNotNull(geoJSON);

                Feature feature = geoJSONFormat.readFeature(geoJSON, null);

                assertNotNull(feature);
                // assertTrue(features.length > 0);
            }
        });

    }
	
	private Feature createTestFeature() {
		
		Coordinate coordinate1 = OLFactory.createCoordinate(1, 1);
		Coordinate coordinate2 = OLFactory.createCoordinate(5, 5);
		Coordinate[] coordinates = { coordinate1, coordinate2 };
		LineString lineString = OLFactory.createLineString(coordinates);

		// Create feature
		FeatureOptions featureOptions = OLFactory.createOptions();
		featureOptions.setGeometry(lineString);
		return OLFactory.createFeature(featureOptions);
		
	}

}

{'fraction_non_alphanumeric': 0.09042023501294563, 'fraction_numerical': 0.003983270264887473, 'mean_word_length': 2.8930232558139535, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3746133', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1320, 'n_words': 261}