    1   /*
    2    * Copyright 2006 The Apache Software Foundation.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  package org.apache.commons.scxml;
    17
    18  import java.util.HashSet;
    19  import java.util.Set;
    20
    21  import org.apache.commons.scxml.model.State;
    22  import org.apache.commons.scxml.model.TransitionTarget;
    23
    24  import junit.framework.Test;
    25  import junit.framework.TestCase;
    26  import junit.framework.TestSuite;
    27
    28  public class BuiltinTest extends TestCase {
    29
    30      public BuiltinTest(String testName) {
    31          super(testName);
    32      }
    33
    34      public static Test suite() {
    35          return new TestSuite(BuiltinTest.class);
    36      }
    37
    38      public static void main(String args[]) {
    39          String[] testCaseName = { BuiltinTest.class.getName()};
    40          junit.textui.TestRunner.main(testCaseName);
    41      }
    42
    43      public void testIsMemberEmptySet() {
    44          Set set = new HashSet();
    45
    46          assertFalse(Builtin.isMember(set, "on"));
    47      }
    48
    49      public void testIsMemberFalse() {
    50          TransitionTarget state = new State();
    51          state.setId("off");
    52
    53          Set set = new HashSet();
    54          set.add(state);
    55
    56          assertFalse(Builtin.isMember(set, "on"));
    57      }
    58
    59      public void testIsMemberTrue() {
    60          TransitionTarget state = new State();
    61          state.setId("on");
    62
    63          Set set = new HashSet();
    64          set.add(state);
    65
    66          assertTrue(Builtin.isMember(set, "on"));
    67      }
    68
    69  }