You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2018/10/14 14:10:45 UTC

[GitHub] Izakey closed pull request #5: Put unit tests together in single test class, Use unique Egyptian god

Izakey closed pull request #5: Put unit tests together in single test class, Use unique Egyptian god
URL: https://github.com/apache/fineract-cn-reporting/pull/5
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/AbstractReportingSpecificationTest.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/AbstractReportingSpecificationTest.java
index 528bad0..ed375b7 100644
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/AbstractReportingSpecificationTest.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/reporting/AbstractReportingSpecificationTest.java
@@ -52,7 +52,7 @@
     webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
     classes = {AbstractReportingSpecificationTest.TestConfiguration.class}
 )
-public class AbstractReportingSpecificationTest {
+public class AbstractReportingSpecificationTest extends SuiteTestEnvironment {
   private static final String APP_NAME = "reporting-v1";
   public static final String LOGGER_NAME = "test-logger";
 
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/SuiteTestEnvironment.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/SuiteTestEnvironment.java
new file mode 100644
index 0000000..9a65c5f
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/reporting/SuiteTestEnvironment.java
@@ -0,0 +1,40 @@
+/*
+ * 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.fineract.cn.reporting;
+
+import org.apache.fineract.cn.test.env.TestEnvironment;
+import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
+import org.apache.fineract.cn.test.fixture.mariadb.MariaDBInitializer;
+import org.junit.ClassRule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.RunExternalResourceOnce;
+import org.junit.rules.TestRule;
+
+public class SuiteTestEnvironment {
+  static final String APP_NAME = "reporting-v1";
+  static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
+  static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
+  static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
+
+  @ClassRule
+  public static TestRule orderClassRules = RuleChain
+          .outerRule(new RunExternalResourceOnce(testEnvironment))
+          .around(new RunExternalResourceOnce(cassandraInitializer))
+          .around(new RunExternalResourceOnce(mariaDBInitializer));
+}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestBalanceSheetReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestBalanceSheetReportSpecification.java
deleted file mode 100644
index d8ae817..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestBalanceSheetReportSpecification.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestBalanceSheetReportSpecification extends AbstractReportingSpecificationTest {
-
-    public TestBalanceSheetReportSpecification() {
-        super();
-    }
-
-    @Test
-    public void shouldReturnReportDefinition() {
-        final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Accounting");
-        Assert.assertTrue(
-                reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Balancesheet"))
-        );
-    }
-}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestCustomerListReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestCustomerListReportSpecification.java
deleted file mode 100644
index 7fdae97..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestCustomerListReportSpecification.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestCustomerListReportSpecification extends AbstractReportingSpecificationTest {
-
-  public TestCustomerListReportSpecification() {
-    super();
-  }
-
-  @Test
-  public void shouldReturnReportDefinition() {
-    final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Customer");
-    Assert.assertTrue(
-        reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
-    );
-  }
-}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestDepositListReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestDepositListReportSpecification.java
deleted file mode 100644
index d13fcf6..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestDepositListReportSpecification.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestDepositListReportSpecification extends AbstractReportingSpecificationTest {
-    public TestDepositListReportSpecification() {
-        super();
-    }
-
-    @Test
-    public void shouldReturnReportDefinition() {
-        final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Deposit");
-        Assert.assertTrue(
-                reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
-        );
-    }
-}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestIncomeStatementReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestIncomeStatementReportSpecification.java
deleted file mode 100644
index d919828..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestIncomeStatementReportSpecification.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestIncomeStatementReportSpecification extends AbstractReportingSpecificationTest {
-    public TestIncomeStatementReportSpecification() {
-        super();
-    }
-
-    @Test
-    public void shouldReturnReportDefinition() {
-        final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Accounting");
-        Assert.assertTrue(
-                reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Incomestatement"))
-        );
-    }
-}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestLoanListReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestLoanListReportSpecification.java
deleted file mode 100644
index 49075cf..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestLoanListReportSpecification.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestLoanListReportSpecification extends AbstractReportingSpecificationTest{
-    public TestLoanListReportSpecification() {
-        super();
-    }
-
-    @Test
-    public void shouldReturnReportDefinition() {
-        final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Loan");
-        Assert.assertTrue(
-                reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
-        );
-    }
-}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestReportingSpecifications.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestReportingSpecifications.java
new file mode 100644
index 0000000..4c0c73c
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestReportingSpecifications.java
@@ -0,0 +1,84 @@
+/*
+ * 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.fineract.cn.reporting;
+
+import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+public class TestReportingSpecifications extends AbstractReportingSpecificationTest {
+
+  @Test
+  public void shouldReturnBalanceSheetReportDefinition() {
+    final List<ReportDefinition> balanceSheetReportDefinitions = super.testSubject.fetchReportDefinitions("Accounting");
+    Assert.assertTrue(
+            balanceSheetReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Balancesheet"))
+    );
+  }
+
+  @Test
+  public void shouldReturnCustomerListReportDefinition() {
+    final List<ReportDefinition> customerListReportDefinitions = super.testSubject.fetchReportDefinitions("Customer");
+    Assert.assertTrue(
+            customerListReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
+    );
+  }
+
+  @Test
+  public void shouldReturnDepositListReportDefinition() {
+    final List<ReportDefinition> depositListReportDefinitions = super.testSubject.fetchReportDefinitions("Deposit");
+    Assert.assertTrue(
+            depositListReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
+    );
+  }
+
+  @Test
+  public void shouldReturnIncomeStatementReportDefinition() {
+    final List<ReportDefinition> incomeStatementReportDefinitions = super.testSubject.fetchReportDefinitions("Accounting");
+    Assert.assertTrue(
+            incomeStatementReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Incomestatement"))
+    );
+  }
+
+  @Test
+  public void shouldReturnLoanListReportDefinition() {
+    final List<ReportDefinition> loanListReportDefinitions = super.testSubject.fetchReportDefinitions("Loan");
+    Assert.assertTrue(
+            loanListReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
+    );
+  }
+
+  @Test
+  public void shouldReturnTellerListReportDefinition() {
+    final List<ReportDefinition> tellerListReportDefinitions = super.testSubject.fetchReportDefinitions("Teller");
+    Assert.assertTrue(
+            tellerListReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
+    );
+  }
+
+  @Test
+  public void shouldReturnTellerTransactionReportDefinition() {
+    final List<ReportDefinition> tellerTransactionReportDefinitions = super.testSubject.fetchReportDefinitions("Teller");
+    Assert.assertTrue(
+            tellerTransactionReportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Transactions"))
+    );
+  }
+}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestTellerListReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestTellerListReportSpecification.java
deleted file mode 100644
index fe3d2f4..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestTellerListReportSpecification.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestTellerListReportSpecification extends AbstractReportingSpecificationTest {
-    public TestTellerListReportSpecification() {
-        super();
-    }
-
-    @Test
-    public void shouldReturnReportDefinition() {
-        final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Teller");
-        Assert.assertTrue(
-                reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Listing"))
-        );
-    }
-}
diff --git a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestTellerTransactionReportSpecification.java b/component-test/src/main/java/org/apache/fineract/cn/reporting/TestTellerTransactionReportSpecification.java
deleted file mode 100644
index fb76bc3..0000000
--- a/component-test/src/main/java/org/apache/fineract/cn/reporting/TestTellerTransactionReportSpecification.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.fineract.cn.reporting;
-
-import org.apache.fineract.cn.reporting.api.v1.domain.ReportDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.List;
-
-public class TestTellerTransactionReportSpecification extends AbstractReportingSpecificationTest {
-    public TestTellerTransactionReportSpecification() {
-        super();
-    }
-
-    @Test
-    public void shouldReturnReportDefinition() {
-        final List<ReportDefinition> reportDefinitions = super.testSubject.fetchReportDefinitions("Teller");
-        Assert.assertTrue(
-                reportDefinitions.stream().anyMatch(reportDefinition -> reportDefinition.getIdentifier().equals("Transactions"))
-        );
-    }
-}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services