<commit_before>package gov.nih.nci.iso21090;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import gov.nih.nci.iso21090.Tel;
import gov.nih.nci.iso21090.TelUrl;

import java.net.URI;

import org.junit.Before;
import org.junit.Test;

/**
 *
 * @author lpower
 */
public class TelUrlTest {

    private TelUrl t;
    private final String FILE = "file:";
    private final String NFS = "nfs:";
    private final String FTP = "ftp:";
    private final String CID = "cid:";
    private final String HTTP = "http:";
    private final String HTTPS = "https:";
    private final String phrase = "this+is+the+way+the+world+ends";    
    
    @Before
    public void init() {
        t = new TelUrl();
    }

    @Test(expected = IllegalArgumentException.class)
    public void testValueAny() {
        t.setValue(URI.create(phrase));
    }

    public static void testAllowed(Tel t, String... allowed) {
        for (String scheme : allowed) {
            String u = scheme + "not+with+a+bang,+but+a+whimper";
            t.setValue(URI.create(u));
            assertEquals(u, t.getValue().toString());
        }
    }

    public static void testDisallowed(Tel t, String... disallowed) {
        for (String scheme : disallowed) {
            String u = scheme + "this+is+the+way+the+world+ends";
            URI uri = URI.create(u);
            try{
                t.setValue(uri);
                fail(scheme);
            } catch (IllegalArgumentException i) {
            }
        }
    }

    @Test
    public void testSchemes() {
        testAllowed(t, FILE, NFS, FTP, CID, HTTP, HTTPS, "File:", "HttpS:", "cId:");<commit_msg>Removed cid to be consistent with xsd<commit_after>package gov.nih.nci.iso21090;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import gov.nih.nci.iso21090.Tel;
import gov.nih.nci.iso21090.TelUrl;

import java.net.URI;

import org.junit.Before;
import org.junit.Test;

/**
 *
 * @author lpower
 */
public class TelUrlTest {

    private TelUrl t;
    private final String FILE = "file:";
    private final String NFS = "nfs:";
    private final String FTP = "ftp:";
    private final String HTTP = "http:";
    private final String HTTPS = "https:";
    private final String phrase = "this+is+the+way+the+world+ends";

    @Before
    public void init() {
        t = new TelUrl();
    }

    @Test(expected = IllegalArgumentException.class)
    public void testValueAny() {
        t.setValue(URI.create(phrase));
    }

    public static void testAllowed(Tel t, String... allowed) {
        for (String scheme : allowed) {
            String u = scheme + "not+with+a+bang,+but+a+whimper";
            t.setValue(URI.create(u));
            assertEquals(u, t.getValue().toString());
        }
    }

    public static void testDisallowed(Tel t, String... disallowed) {
        for (String scheme : disallowed) {
            String u = scheme + "this+is+the+way+the+world+ends";
            URI uri = URI.create(u);
            try{
                t.setValue(uri);
                fail(scheme);
            } catch (IllegalArgumentException i) {
            }
        }
    }

    @Test
    public void testSchemes() {
        testAllowed(t, FILE, NFS, FTP, HTTP, HTTPS, "File:", "HttpS:");
{'fraction_non_alphanumeric': 0.12940461725394897, 'fraction_numerical': 0.009113001215066828, 'mean_word_length': 2.3913491246138, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7392370', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1026, 'n_words': 258}