Return-Path: X-Original-To: apmail-creadur-commits-archive@www.apache.org Delivered-To: apmail-creadur-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 366E21017B for ; Sun, 8 Dec 2013 21:08:47 +0000 (UTC) Received: (qmail 84470 invoked by uid 500); 8 Dec 2013 21:08:47 -0000 Delivered-To: apmail-creadur-commits-archive@creadur.apache.org Received: (qmail 84444 invoked by uid 500); 8 Dec 2013 21:08:47 -0000 Mailing-List: contact commits-help@creadur.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@creadur.apache.org Delivered-To: mailing list commits@creadur.apache.org Received: (qmail 84437 invoked by uid 99); 8 Dec 2013 21:08:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Dec 2013 21:08:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Dec 2013 21:08:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 19BB32388831; Sun, 8 Dec 2013 21:08:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1549253 - /creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java Date: Sun, 08 Dec 2013 21:08:23 -0000 To: commits@creadur.apache.org From: rdonkin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131208210823.19BB32388831@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rdonkin Date: Sun Dec 8 21:08:22 2013 New Revision: 1549253 URL: http://svn.apache.org/r1549253 Log: Add test: testConstructorILicenseFamily Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java?rev=1549253&r1=1549252&r2=1549253&view=diff ============================================================================== --- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java (original) +++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java Sun Dec 8 21:08:22 2013 @@ -28,6 +28,9 @@ import static org.junit.Assert.assertEqu import org.apache.rat.api.Document; import org.apache.rat.api.MetaData; import org.apache.rat.document.MockLocation; +import org.apache.rat.license.Apache20LicenseFamily; +import org.apache.rat.license.ILicenseFamily; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -45,10 +48,9 @@ public class DefaultPolicyTest { /** * Sets the up. * - * @throws Exception the exception */ @Before - public void setUp() throws Exception { + public void setUp() { policy = new DefaultPolicy(); subject = new MockLocation("subject"); } @@ -56,10 +58,9 @@ public class DefaultPolicyTest { /** * Test al family. * - * @throws Exception the exception */ @Test - public void testALFamily() throws Exception { + public void testALFamily() { subject.getMetaData().set( new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME, APACHE .getName())); @@ -72,8 +73,6 @@ public class DefaultPolicyTest { * * @param pApproved the approved */ - @SuppressWarnings("boxing") - // OK in test code private void assertApproval(final boolean pApproved) { assertEquals("Metadata value are equals.", pApproved, MetaData.RAT_APPROVED_LICENSE_VALUE_TRUE @@ -84,10 +83,9 @@ public class DefaultPolicyTest { /** * Test oasis family. * - * @throws Exception the exception */ @Test - public void testOASISFamily() throws Exception { + public void testOASISFamily() { subject.getMetaData().set( new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME, OASIS .getName())); @@ -98,10 +96,9 @@ public class DefaultPolicyTest { /** * Test w3 c family. * - * @throws Exception the exception */ @Test - public void testW3CFamily() throws Exception { + public void testW3CFamily() { subject.getMetaData().set( new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME, W3C .getName())); @@ -112,10 +109,9 @@ public class DefaultPolicyTest { /** * Test w3 c doc family. * - * @throws Exception the exception */ @Test - public void testW3CDocFamily() throws Exception { + public void testW3CDocFamily() { subject.getMetaData().set( new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME, W3C_DOCUMENTATION.getName())); @@ -126,10 +122,9 @@ public class DefaultPolicyTest { /** * Test mit family. * - * @throws Exception the exception */ @Test - public void testMITFamily() throws Exception { + public void testMITFamily() { subject.getMetaData().set( new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME, MIT .getName())); @@ -140,13 +135,26 @@ public class DefaultPolicyTest { /** * Test unknown family. * - * @throws Exception the exception */ @Test - public void testUnknownFamily() throws Exception { + public void testUnknownFamily() { subject.getMetaData().set( MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_UNKNOWN); policy.analyse(subject); assertApproval(false); } + + /** + * Test constructor i license family. + * + * @throws Exception + * the exception + */ + @Test + public void testConstructorILicenseFamily() throws Exception { + ILicenseFamily[] approvedLicenses = new ILicenseFamily[1]; + approvedLicenses[0] = new Apache20LicenseFamily(); + policy = new DefaultPolicy(approvedLicenses); + Assert.assertNotNull(policy); + } }