<commit_before>package org.xmlcml.ami2.lookups;

import java.io.File;
import java.io.FileOutputStream;
import java.util.List;

import org.apache.commons.io.IOUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.xmlcml.cmine.lookup.AbstractLookup;

public class GBIFLookupTest {

	
	private static final String CANONICAL_NAME_PATH = "$.results[0].canonicalName";
	public static final Logger LOG = Logger.getLogger(GBIFLookupTest.class);
	static {
		LOG.setLevel(Level.DEBUG);
	}

	@Test
//	@Ignore // LOOKUP // comment out if running offline or on Jenkins
	public void testLookupCommonName() throws Exception {
		AbstractLookup gbifLookup = new GBIFLookup();
		String json = gbifLookup.lookup("Blue+whale");
		LOG.trace("result: "+json);
		new File("target/gbif/").mkdirs();
		IOUtils.write(json, new FileOutputStream("target/gbif/whale.json"));
		String canonicalName = gbifLookup.getStringForJsonPath(json, CANONICAL_NAME_PATH);
		// this test seems unstable - sometimes the subspecies is given
		Assert.assertTrue("name", canonicalName.startsWith("Balaenoptera musculus"), canonicalName);
	}
	

}<commit_msg>fixed tests (still need to trap Tessercat NPE)<commit_after>package org.xmlcml.ami2.lookups;

import java.io.File;
import java.io.FileOutputStream;
import java.util.List;

import org.apache.commons.io.IOUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.xmlcml.cmine.lookup.AbstractLookup;

public class GBIFLookupTest {

	
	private static final String CANONICAL_NAME_PATH = "$.results[0].canonicalName";
	public static final Logger LOG = Logger.getLogger(GBIFLookupTest.class);
	static {
		LOG.setLevel(Level.DEBUG);
	}

	@Test
//	@Ignore // LOOKUP // comment out if running offline or on Jenkins
	public void testLookupCommonName() throws Exception {
		AbstractLookup gbifLookup = new GBIFLookup();
		String json = gbifLookup.lookup("Blue+whale");
		LOG.trace("result: "+json);
		new File("target/gbif/").mkdirs();
		IOUtils.write(json, new FileOutputStream("target/gbif/whale.json"));
		String canonicalName = gbifLookup.getStringForJsonPath(json, CANONICAL_NAME_PATH);
		// this test seems unstable - sometimes the subspecies is given
		Assert.assertTrue("name", canonicalName.startsWith("Balaenoptera musculus"));
	}
	

}
{'fraction_non_alphanumeric': 0.11757322175732217, 'fraction_numerical': 0.0033472803347280333, 'mean_word_length': 5.242819843342037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3399380', 'n_tokens_mistral': 810, 'n_tokens_neox': 761, 'n_words': 174}