You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by rd...@apache.org on 2013/12/06 20:27:07 UTC
svn commit: r1548682 - in /creadur/rat/branches/gsoc/apache-rat-core/src:
main/java/org/apache/rat/analysis/license/BaseLicense.java
test/java/org/apache/rat/analysis/license/BaseLicenseTest.java
Author: rdonkin
Date: Fri Dec 6 19:27:06 2013
New Revision: 1548682
URL: http://svn.apache.org/r1548682
Log:
Add constructor taking license family
Added:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/BaseLicenseTest.java (with props)
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java?rev=1548682&r1=1548681&r2=1548682&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java (original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java Fri Dec 6 19:27:06 2013
@@ -20,6 +20,7 @@ package org.apache.rat.analysis.license;
import org.apache.rat.api.Document;
import org.apache.rat.api.MetaData;
+import org.apache.rat.api.domain.LicenseFamily;
/**
* The Class BaseLicense.
@@ -75,6 +76,18 @@ public class BaseLicense {
}
/**
+ * Constructs a license based on the given family.
+ *
+ * @param licenseFamily
+ * not null
+ */
+ public BaseLicense(final LicenseFamily licenseFamily) {
+ this.notes = licenseFamily.getNotes();
+ this.licenseFamilyCategory = licenseFamily.getCategory();
+ this.licenseFamilyName = licenseFamily.getName();
+ }
+
+ /**
* Gets the license family category.
*
* @return the license family category
Added: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/BaseLicenseTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/BaseLicenseTest.java?rev=1548682&view=auto
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/BaseLicenseTest.java (added)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/BaseLicenseTest.java Fri Dec 6 19:27:06 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 BaseLicenseTest {
+
+ @Test
+ public void testLicenseFamilyConstructorSetsNotes() {
+ final String someNotes = "Some notes about a license family";
+ assertThat(new BaseLicense(aLicenseFamily().withNotes(someNotes)
+ .build()).getNotes(), is(someNotes));
+ }
+
+ @Test
+ public void testLicenseFamilyConstructorSetsCategory() {
+ final String someCategory = "http://some.category.org";
+ assertThat(new BaseLicense(aLicenseFamily().withCategory(someCategory)
+ .build()).getLicenseFamilyCategory(), is(someCategory));
+ }
+
+ @Test
+ public void testLicenseFamilyConstructorSetsName() {
+ final String someName = "http://some.name.org";
+ assertThat(
+ new BaseLicense(aLicenseFamily().withName(someName).build())
+ .getLicenseFamilyName(),
+ is(someName));
+ }
+
+}
Propchange: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/BaseLicenseTest.java
------------------------------------------------------------------------------
svn:eol-style = native