Author: rdonkin
Date: Fri Dec 6 09:43:19 2013
New Revision: 1548469
URL: http://svn.apache.org/r1548469
Log:
Format Code.
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java?rev=1548469&r1=1548468&r2=1548469&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
Fri Dec 6 09:43:19 2013
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
- */
+ */
package org.apache.rat.analysis.license;
import java.io.BufferedReader;
@@ -33,70 +33,72 @@ import static org.junit.Assert.assertTru
public class AppliedApacheSoftwareLicense20Test {
- private static final String HEADER
- = "/*\n"
- + " * Copyright 2012-2013 FooBar.\n"
- + " *\n"
- + " * Licensed under the Apache License, Version 2.0 (the
\"License\");\n"
- + " * you may not use this file except in compliance with the
License.\n"
- + " *\n"
- + " * You may obtain a copy of the License at\n"
- + " * http://www.apache.org/licenses/LICENSE-2.0\n"
- + " *\n"
- + " * Unless required by applicable law or agreed to in writing,
software\n"
- + " * distributed under the License is distributed on an \"AS
IS\" BASIS,\n"
- + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.\n"
- + " * See the License for the specific language governing
permissions and\n"
- + " * limitations under the License.\n"
- + " */\n";
-
- AppliedApacheSoftwareLicense20 license;
-
- MockClaimReporter reporter;
-
- @Before
- public void setUp() throws Exception {
- license = new AppliedApacheSoftwareLicense20("FooBar");
- reporter = new MockClaimReporter();
- }
-
- @Test
- public void match() throws Exception {
- BufferedReader in = new BufferedReader(new StringReader(HEADER));
- String line = in.readLine();
- boolean result = false;
- final Document subject = new MockLocation("subject");
- while (line != null) {
- result = license.match(subject, line);
- line = in.readLine();
- }
- assertTrue("Applied AL2.0 license should be matched", result);
- license.reset();
- result = license.match(subject, "New line");
- assertFalse("After reset, content should build up again", result);
- }
-
- @Test
- public void noMatch() throws Exception {
- BufferedReader in =
Resources.getBufferedResourceReader("elements/Source.java");
- String line = in.readLine();
- boolean result = false;
- final Document subject = new MockLocation("subject");
- while (line != null) {
- result = license.match(subject, line);
- line = in.readLine();
- }
- assertFalse("Applied AL2.0 license should not be matched", result);
- license.reset();
- }
- @Test(timeout=2000) // may need to be adjusted if many more files are added
- public void goodFiles() throws Exception {
- DirectoryScanner.testFilesInDir("appliedAL20/good", license, true);
- }
-
- @Test(timeout=2000) // may need to be adjusted if many more files are added
- public void baddFiles() throws Exception {
- DirectoryScanner.testFilesInDir("appliedAL20/bad", license, false);
- }
-
+ private static final String HEADER = "/*\n"
+ + " * Copyright 2012-2013 FooBar.\n"
+ + " *\n"
+ + " * Licensed under the Apache License, Version 2.0
(the \"License\");\n"
+ + " * you may not use this file except in compliance
with the License.\n"
+ + " *\n"
+ + " * You may obtain a copy of the License at\n"
+ + " *
http://www.apache.org/licenses/LICENSE-2.0\n"
+ + " *\n"
+ + " * Unless required by applicable law or agreed to
in writing, software\n"
+ + " * distributed under the License is distributed on
an \"AS IS\" BASIS,\n"
+ + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.\n"
+ + " * See the License for the specific language
governing permissions and\n"
+ + " * limitations under the License.\n" + " */\n";
+
+ AppliedApacheSoftwareLicense20 license;
+
+ MockClaimReporter reporter;
+
+ @Before
+ public void setUp() throws Exception {
+ license = new AppliedApacheSoftwareLicense20("FooBar");
+ reporter = new MockClaimReporter();
+ }
+
+ @Test
+ public void match() throws Exception {
+ BufferedReader in = new BufferedReader(new
StringReader(HEADER));
+ String line = in.readLine();
+ boolean result = false;
+ final Document subject = new MockLocation("subject");
+ while (line != null) {
+ result = license.match(subject, line);
+ line = in.readLine();
+ }
+ assertTrue("Applied AL2.0 license should be matched", result);
+ license.reset();
+ result = license.match(subject, "New line");
+ assertFalse("After reset, content should build up again",
result);
+ }
+
+ @Test
+ public void noMatch() throws Exception {
+ BufferedReader in = Resources
+
.getBufferedResourceReader("elements/Source.java");
+ String line = in.readLine();
+ boolean result = false;
+ final Document subject = new MockLocation("subject");
+ while (line != null) {
+ result = license.match(subject, line);
+ line = in.readLine();
+ }
+ assertFalse("Applied AL2.0 license should not be matched",
result);
+ license.reset();
+ }
+
+ @Test(timeout = 2000)
+ // may need to be adjusted if many more files are added
+ public void goodFiles() throws Exception {
+ DirectoryScanner.testFilesInDir("appliedAL20/good", license,
true);
+ }
+
+ @Test(timeout = 2000)
+ // may need to be adjusted if many more files are added
+ public void baddFiles() throws Exception {
+ DirectoryScanner.testFilesInDir("appliedAL20/bad", license,
false);
+ }
+
}