This is an automated email from the ASF dual-hosted git repository. awasum pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/fineract-cn-reporting.git
commit 1d0699a7fcaa3522d8bff5fc1b8e39b5006d7011 Author: Isaac Kamga <[email protected]> AuthorDate: Sun Oct 14 15:07:18 2018 +0100 Put unit tests together in single test class and use unique Egyptian god shu for reporting service test user --- .../AbstractReportingSpecificationTest.java | 2 +- .../cn/reporting/SuiteTestEnvironment.java | 40 +++++++++++ .../TestBalanceSheetReportSpecification.java | 40 ----------- .../TestCustomerListReportSpecification.java | 40 ----------- .../TestDepositListReportSpecification.java | 39 ---------- .../TestIncomeStatementReportSpecification.java | 39 ---------- .../reporting/TestLoanListReportSpecification.java | 39 ---------- .../cn/reporting/TestReportingSpecifications.java | 84 ++++++++++++++++++++++ .../TestTellerListReportSpecification.java | 39 ---------- .../TestTellerTransactionReportSpecification.java | 39 ---------- 10 files changed, 125 insertions(+), 276 deletions(-) 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 @@ import org.springframework.test.context.junit4.SpringRunner; 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")) - ); - } -}
