Skip to content
Permalink
Browse files
Merge pull request #5 from Izakey/develop
Put unit tests together in single test class and use unique Egyptian god "shu" for reporting service test user
  • Loading branch information
Izakey committed Oct 14, 2018
2 parents a59b904 + 1d0699a commit 2c300e96742db46bef6a191e9752cfda02dcc989
Showing 10 changed files with 125 additions and 276 deletions.
@@ -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";

@@ -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));
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -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"))
);
}
}

This file was deleted.

0 comments on commit 2c300e9

Please sign in to comment.