View | Details | Raw Unified | Return to bug 61759
Collapse All | Expand All

(-)src/functions/org/apache/jmeter/functions/ChangeCase.java (-1 / +1 lines)
Lines 50-56 Link Here
50
public class ChangeCase extends AbstractFunction {
50
public class ChangeCase extends AbstractFunction {
51
51
52
    private static final Pattern NOT_ALPHANUMERIC_REGEX = 
52
    private static final Pattern NOT_ALPHANUMERIC_REGEX = 
53
            Pattern.compile("[^a-zA-Z]");
53
            Pattern.compile("[\\s\\-_]+");
54
    private static final Logger LOGGER = LoggerFactory.getLogger(ChangeCase.class);
54
    private static final Logger LOGGER = LoggerFactory.getLogger(ChangeCase.class);
55
    private static final List<String> DESC = new LinkedList<>();
55
    private static final List<String> DESC = new LinkedList<>();
56
    private static final String KEY = "__changeCase";
56
    private static final String KEY = "__changeCase";
(-)test/src/org/apache/jmeter/functions/TestChangeCase.java (-5 / +14 lines)
Lines 144-163 Link Here
144
    
144
    
145
    @Test
145
    @Test
146
    public void testEmptyMode() throws Exception {
146
    public void testEmptyMode() throws Exception {
147
        params.add(new CompoundVariable("ab-CD eF"));
147
        params.add(new CompoundVariable("ab_ -CD eF"));
148
        params.add(new CompoundVariable(""));
148
        params.add(new CompoundVariable(""));
149
        changeCase.setParameters(params);
149
        changeCase.setParameters(params);
150
        String returnValue = changeCase.execute(result, null);
150
        String returnValue = changeCase.execute(result, null);
151
        assertEquals("AB-CD EF", returnValue);
151
        assertEquals("AB_ -CD EF", returnValue);
152
    }
152
    }
153
153
    
154
    @Test
154
    @Test
155
    public void testChangeCaseWrongModeIgnore() throws Exception {
155
    public void testChangeCaseWrongModeIgnore() throws Exception {
156
    	params.add(new CompoundVariable("ab-CD eF"));
156
    	params.add(new CompoundVariable("ab-CD eF"));
157
        params.add(new CompoundVariable("Wrong"));
157
    	params.add(new CompoundVariable("Wrong"));
158
    	changeCase.setParameters(params);
159
    	String returnValue = changeCase.execute(result, null);
160
    	assertEquals("ab-CD eF", returnValue);
161
    }
162
163
    @Test
164
    public void testChangeCaseNonEnglish() throws Exception {
165
    	params.add(new CompoundVariable("ab-àÀè_È é É ù Ù ì Ì ò Ò ñ ÑäöüßCD   eF"));
166
        params.add(new CompoundVariable("LOWER_CAMEL_CASE"));
158
        changeCase.setParameters(params);
167
        changeCase.setParameters(params);
159
        String returnValue = changeCase.execute(result, null);
168
        String returnValue = changeCase.execute(result, null);
160
        assertEquals("ab-CD eF", returnValue);
169
        assertEquals("abÀàèÈÉÉÙÙÌÌÒÒÑÑäöüßcdEf", returnValue);
161
    }
170
    }
162
171
163
}
172
}

Return to bug 61759