gov.nih.nci.cabig.ccts.util.BooleanDelimiterTest.java Source code

Java tutorial

Introduction

Here is the source code for gov.nih.nci.cabig.ccts.util.BooleanDelimiterTest.java

Source

/*
 * Copyright Northwestern University and SemanticBits, LLC
 * 
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/ctms-commons/LICENSE.txt for details.
 */
package gov.nih.nci.cabig.ccts.util;

import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author Ion C. Olaru
 *
 */
public class BooleanDelimiterTest extends TestCase {

    public void testDelimiter() {
        String[] s = BooleanDelimiter.parseBoolean("study_creator");
        assertEquals(1, s.length);
        assertEquals("study_creator", s[0]);

        s = BooleanDelimiter.parseBoolean("study_creator && study_qa_manager");
        assertEquals(2, s.length);
        assertEquals("study_creator", s[0]);
        assertEquals("study_qa_manager", s[1]);

        s = BooleanDelimiter.parseBoolean("study_creator || study_qa_manager & study_calendar_template_builder");
        assertEquals(3, s.length);
        assertEquals("study_creator", s[0]);
        assertEquals("study_qa_manager", s[1]);
        assertEquals("study_calendar_template_builder", s[2]);

        s = BooleanDelimiter.parseBoolean("study_creator=study_qa_manager");
        assertEquals(1, s.length);
        assertEquals("study_creator=study_qa_manager", s[0]);

    }
}