Skip to content

Commit fc52c25

Browse files
committed
add common utils and matcher class
1 parent eaff5d0 commit fc52c25

File tree

4 files changed

+287
-342
lines changed

4 files changed

+287
-342
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Copyright (c) 2011-2024 Qulice.com
3+
*
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions
8+
* are met: 1) Redistributions of source code must retain the above
9+
* copyright notice, this list of conditions and the following
10+
* disclaimer. 2) Redistributions in binary form must reproduce the above
11+
* copyright notice, this list of conditions and the following
12+
* disclaimer in the documentation and/or other materials provided
13+
* with the distribution. 3) Neither the name of the Qulice.com nor
14+
* the names of its contributors may be used to endorse or promote
15+
* products derived from this software without specific prior written
16+
* permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
20+
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22+
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29+
* OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
package com.qulice.checkstyle;
32+
33+
import org.junit.jupiter.api.BeforeAll;
34+
import org.junit.jupiter.api.BeforeEach;
35+
import org.junit.jupiter.api.Test;
36+
import org.junit.jupiter.api.TestInstance;
37+
38+
/**
39+
* Test case for file metainfo validation.
40+
* @since 0.3
41+
*/
42+
@SuppressWarnings(
43+
{
44+
"PMD.TooManyMethods", "PMD.AvoidDuplicateLiterals", "PMD.GodClass"
45+
}
46+
)
47+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
48+
final class CheckstyleMetainfoTest {
49+
50+
/**
51+
* Local Common (JavaHelper pattern) with useful utils to test checkstyle.
52+
*/
53+
private Common common;
54+
55+
@BeforeAll
56+
public void setcommon() {
57+
this.common = new Common();
58+
}
59+
60+
@BeforeEach
61+
public void setRule() {
62+
this.common.updateRule();
63+
}
64+
65+
/**
66+
* CheckstyleValidator can deny binary contents in java file.
67+
* This is test for #1264.
68+
* @throws Exception If something wrong happens inside
69+
*/
70+
@Test
71+
void rejectsJavaFileWithBinaryContent() throws Exception {
72+
this.common.runValidation("JavaFileWithBinaryContent.java", false);
73+
}
74+
}

0 commit comments

Comments
 (0)