Author: rdonkin
Date: Fri Dec 6 19:30:49 2013
New Revision: 1548686
URL: http://svn.apache.org/r1548686
Log:
Prefer an enumeration to factory.
Added:
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
(contents, props changed)
- copied, changed from r1548685,
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/LicenseFamilyFactoryTest.java
Removed:
creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/LicenseFamilyFactory.java
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/LicenseFamilyFactoryTest.java
Modified:
creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
Modified:
creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java?rev=1548686&r1=1548685&r2=1548686&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
Fri Dec 6 19:30:49 2013
@@ -20,15 +20,32 @@ package org.apache.rat.api.domain;
import static org.apache.rat.api.domain.LicenseFamilyBuilder.aLicenseFamily;
+/**
+ * Enumerates standard license families known to Rat.
+ */
public enum RatLicenseFamily {
W3C("W3C Software Copyright", "W3C ", "");
+ /** @see LicenseFamily#getName() */
private final String name;
+ /** @see LicenseFamily#getCategory() */
private final String category;
+ /** @see LicenseFamily#getNotes() */
private final String notes;
+ /** Constructed from other data */
private final LicenseFamily licenseFamily;
+ /**
+ * Constructs an instance.
+ *
+ * @param name
+ * not null
+ * @param category
+ * not null
+ * @param notes
+ * not null
+ */
private RatLicenseFamily(final String name, final String category,
final String notes) {
this.name = name;
@@ -38,18 +55,38 @@ public enum RatLicenseFamily {
.withName(getName()).withNotes(getNotes()).build();
}
+ /**
+ * @see LicenseFamily#getName()
+ *
+ * @return not null
+ */
public String getName() {
return this.name;
}
+ /**
+ * @see LicenseFamily#getCategory()
+ *
+ * @return possibly null
+ */
public String getCategory() {
return this.category;
}
+ /**
+ * @see LicenseFamily#getNotes()
+ *
+ * @return possibly null
+ */
public String getNotes() {
return this.notes;
}
+ /**
+ * Gets a {@link LicenseFamily} representing this data.
+ *
+ * @return not null
+ */
public LicenseFamily licenseFamily() {
return this.licenseFamily;
}
Copied:
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
(from r1548685,
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/LicenseFamilyFactoryTest.java)
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java?p2=creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java&p1=creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/LicenseFamilyFactoryTest.java&r1=1548685&r2=1548686&rev=1548686&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/LicenseFamilyFactoryTest.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
Fri Dec 6 19:30:49 2013
@@ -18,32 +18,26 @@
*/
package org.apache.rat.api.domain;
+import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
-public class LicenseFamilyFactoryTest {
+public class RatLicenseFamilyTest {
@Test
public void testW3CLicenseFamilyCategory() {
- final LicenseFamily family = LicenseFamilyFactory.w3c();
- assertThat(family.getCategory(),
- is(W3C.getCategory()));
+ assertThat(W3C.getCategory(), is("W3C "));
}
@Test
public void testW3CLicenseFamilyName() {
- final LicenseFamily family = LicenseFamilyFactory.w3c();
- assertThat(
- family.getName(),
- is(W3C.getName()));
+ assertThat(W3C.getName(), is("W3C Software Copyright"));
}
@Test
public void testW3CLicenseFamilyNotes() {
- final LicenseFamily family = LicenseFamilyFactory.w3c();
- assertThat(family.getNotes(), is(""));
+ assertThat(W3C.getNotes(), is(""));
}
}
Propchange:
creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
------------------------------------------------------------------------------
svn:eol-style = native