/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.apache.jmeter.gui.util;

import org.apache.jmeter.junit.JMeterTestCase;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;

public class JSyntaxTextAreaTest extends JMeterTestCase {

  public void testSetLanguage(){
    JSyntaxTextArea textArea = new JSyntaxTextArea(30, 50, false);
    
    try {
      textArea.setLanguage(null);
    } catch(Exception e){
      fail("No Exception expected");
    }
    
    assertEquals(SyntaxConstants.SYNTAX_STYLE_NONE, textArea.getSyntaxEditingStyle());
    
  }
}

@@ -846,46 +846,212 @@
 ort 
-org.apache.jmeter.junit.JMeterTestCase
+java.lang.reflect.Field;%0Aimport java.lang.reflect.Modifier;%0Aimport java.util.HashSet;%0Aimport java.util.Properties;%0A%0Aimport org.apache.jmeter.junit.JMeterTestCase;%0Aimport org.apache.jmeter.util.JMeterUtils
 ;%0Aim
@@ -1479,10 +1479,1278 @@
    %0A  %7D%0A
+  %0A    public void testSyntaxNames() throws IllegalArgumentException,%0A            IllegalAccessException %7B%0A        HashSet%3CString%3E values = new HashSet%3CString%3E();%0A        for (Field field : SyntaxConstants.class.getFields()) %7B%0A            int modifiers = field.getModifiers();%0A            if (field.getType().equals(String.class)%0A                    && Modifier.isStatic(modifiers)%0A                    && Modifier.isPublic(modifiers)) %7B%0A                values.add((String) field.get(null));%0A            %7D%0A        %7D%0A        final Properties languageProperties = JMeterUtils%0A                .loadProperties(%22org/apache/jmeter/gui/util/textarea.properties%22); //$NON-NLS-1$;%0A        for (Object s : languageProperties.values()) %7B%0A            if (!values.contains(s)) %7B%0A                fail(%22Invalid property value: %22 + s);%0A            %7D%0A        %7D%0A        // Show unused entries%0A//        for (Object s : languageProperties.values()) %7B%0A//            values.remove(s);%0A//        %7D%0A//        if (values.size() %3E 0) %7B%0A//            System.out.print(%22Unused JSyntaxAreaTypes:%22);%0A//            for (String value : values) %7B%0A//                System.out.print(%22 %22);%0A//                System.out.print(value);%0A//            %7D%0A//            System.out.println();%0A//        %7D%0A    %7D%0A
 %7D%0A

Check that syntax types have valid values