Author: rdonkin
Date: Fri Dec 6 19:27:41 2013
New Revision: 1548683
URL: http://svn.apache.org/r1548683
Log:
Add constructor for LicenseFamily
Added:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/SimplePatternBasedLicenseTest.java
(with props)
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java?rev=1548683&r1=1548682&r2=1548683&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java
Fri Dec 6 19:27:41 2013
@@ -21,6 +21,7 @@ package org.apache.rat.analysis.license;
import org.apache.rat.analysis.IHeaderMatcher;
import org.apache.rat.api.Document;
import org.apache.rat.api.MetaData.Datum;
+import org.apache.rat.api.domain.LicenseFamily;
/**
* The Class SimplePatternBasedLicense.
@@ -63,6 +64,20 @@ public class SimplePatternBasedLicense e
}
/**
+ * Constructs a license indicated by the given patterns.
+ *
+ * @param pLicenseFamily
+ * not null
+ * @param pPatterns
+ * not null
+ */
+ public SimplePatternBasedLicense(final LicenseFamily pLicenseFamily,
+ final String... pPatterns) {
+ super(pLicenseFamily);
+ setPatterns(pPatterns);
+ }
+
+ /**
* Gets the patterns.
*
* @return the patterns
Added:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/SimplePatternBasedLicenseTest.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/SimplePatternBasedLicenseTest.java?rev=1548683&view=auto
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/SimplePatternBasedLicenseTest.java
(added)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/SimplePatternBasedLicenseTest.java
Fri Dec 6 19:27:41 2013
@@ -0,0 +1,52 @@
+/*
+ * 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.rat.analysis.license;
+
+import static org.apache.rat.api.domain.LicenseFamilyBuilder.aLicenseFamily;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class SimplePatternBasedLicenseTest {
+ @Test
+ public void testLicenseFamilyConstructorSetsNotes() {
+ final String someNotes = "Some notes about a license family";
+ assertThat(
+ new SimplePatternBasedLicense(aLicenseFamily().withNotes(
+ someNotes).build()).getNotes(), is(someNotes));
+ }
+
+ @Test
+ public void testLicenseFamilyConstructorSetsCategory() {
+ final String someCategory = "http://some.category.org";
+ assertThat(
+ new SimplePatternBasedLicense(aLicenseFamily().withCategory(
+ someCategory).build()).getLicenseFamilyCategory(),
+ is(someCategory));
+ }
+
+ @Test
+ public void testLicenseFamilyConstructorSetsName() {
+ final String someName = "http://some.name.org";
+ assertThat(
+ new SimplePatternBasedLicense(aLicenseFamily().withName(
+ someName).build()).getLicenseFamilyName(),
is(someName));
+ }
+}
Propchange:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/SimplePatternBasedLicenseTest.java
------------------------------------------------------------------------------
svn:eol-style = native