1
2
3
4
5 package com.qulice.pmd;
6
7 import org.hamcrest.Matchers;
8 import org.junit.jupiter.api.Test;
9 import org.junit.jupiter.params.ParameterizedTest;
10 import org.junit.jupiter.params.provider.ValueSource;
11
12
13
14
15
16
17
18
19 final class PmdMethodNamingConventionsTest {
20
21 @ParameterizedTest
22 @ValueSource(
23 strings = {
24 "JnaLibraryNames.java",
25 "JnaDirectNames.java",
26 "StdCallNames.java"
27 }
28 )
29 void allowsNativeNamesInJnaBinding(final String file) throws Exception {
30 new PmdAssert(
31 file,
32 Matchers.any(Boolean.class),
33 Matchers.not(
34 Matchers.containsString("MethodNamingConventions")
35 )
36 ).assertOk();
37 }
38
39 @Test
40 void rejectsNativeNamesOutsideJna() throws Exception {
41 new PmdAssert(
42 "FakeLibraryNames.java",
43 Matchers.is(false),
44 Matchers.containsString("MethodNamingConventions")
45 ).assertOk();
46 }
47
48 @Test
49 void prohibitsUnicodeCharactersInMethodNames() throws Exception {
50 new PmdAssert(
51 "UnicodeCharactersInMethodNames.java",
52 Matchers.is(false),
53 Matchers.containsString("MethodNamingConventions")
54 ).assertOk();
55 }
56 }