Search in sources :

Example 1 with FinderInteraction

use of org.incode.module.unittestsupport.dom.repo.FinderInteraction in project estatio by estatio.

the class FixedAssetRoleRepository_Test method setup.

@Before
public void setup() {
    asset = new FixedAssetForTesting();
    party = new PartyForTesting();
    type = FixedAssetRoleTypeEnum.ASSET_MANAGER;
    startDate = new LocalDate(2013, 1, 4);
    endDate = new LocalDate(2013, 2, 5);
    fixedAssetRoleRepository = new FixedAssetRoleRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<FixedAssetRole> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
}
Also used : List(java.util.List) FixedAssetRoleRepository(org.estatio.module.asset.dom.role.FixedAssetRoleRepository) PartyForTesting(org.estatio.module.party.dom.PartyForTesting) LocalDate(org.joda.time.LocalDate) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 2 with FinderInteraction

use of org.incode.module.unittestsupport.dom.repo.FinderInteraction in project estatio by estatio.

the class AgreementRoleTypeRepository_Test method setup.

@Before
public void setup() {
    agreementType = new AgreementType();
    agreementRoleTypeRepository = new AgreementRoleTypeRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<AgreementRoleType> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    QueryResultsCache.Control control = new QueryResultsCache.Control();
    control.on(new FixturesInstallingEvent(new FixtureScriptsDefault()));
    final QueryResultsCache queryResultsCache = new QueryResultsCache() {

        {
            control = new Control();
        }
    };
    agreementRoleTypeRepository.queryResultsCache = queryResultsCache;
}
Also used : AgreementType(org.estatio.module.agreement.dom.type.AgreementType) FixturesInstallingEvent(org.apache.isis.applib.events.system.FixturesInstallingEvent) List(java.util.List) FixtureScriptsDefault(org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault) QueryResultsCache(org.apache.isis.applib.services.queryresultscache.QueryResultsCache) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 3 with FinderInteraction

use of org.incode.module.unittestsupport.dom.repo.FinderInteraction in project estatio by estatio.

the class TaxRateRepository_Test method setup.

@Before
public void setup() {
    tax = new Tax();
    date = new LocalDate(2013, 4, 1);
    taxRateRepository = new TaxRateRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<TaxRate> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
}
Also used : List(java.util.List) LocalDate(org.joda.time.LocalDate) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 4 with FinderInteraction

use of org.incode.module.unittestsupport.dom.repo.FinderInteraction in project estatio by estatio.

the class NumeratorRepository_Test method setup.

@Before
public void setup() {
    propertyBookmark = new Bookmark("PROP", "123");
    applicationTenancy = new ApplicationTenancy();
    applicationTenancy.setPath("/");
    context.checking(new Expectations() {

        {
            allowing(mockBookmarkService).bookmarkFor(mockProperty);
            will(returnValue(propertyBookmark));
        }
    });
    numeratorRepository = new NumeratorRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<Numerator> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    numeratorRepository.bookmarkService = mockBookmarkService;
}
Also used : Expectations(org.jmock.Expectations) Bookmark(org.apache.isis.applib.services.bookmark.Bookmark) List(java.util.List) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 5 with FinderInteraction

use of org.incode.module.unittestsupport.dom.repo.FinderInteraction in project estatio by estatio.

the class InvoiceRepository_Test method setup.

@Before
public void setup() {
    seller = new PartyForTesting();
    buyer = new PartyForTesting();
    paymentMethod = PaymentMethod.BANK_TRANSFER;
    lease = new Lease() {

        @Override
        public Property getProperty() {
            return null;
        }
    };
    invoiceStatus = InvoiceStatus.APPROVED;
    dueDate = new LocalDate(2013, 4, 1);
    invoiceRepository = new InvoiceRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<Invoice> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    invoiceForLeaseRepository = new InvoiceForLeaseRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<InvoiceForLease> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    estatioNumeratorRepository = new NumeratorForCollectionRepository();
}
Also used : Lease(org.estatio.module.lease.dom.Lease) InvoiceRepository(org.estatio.module.invoice.dom.InvoiceRepository) List(java.util.List) PartyForTesting(org.estatio.module.party.dom.PartyForTesting) Property(org.estatio.module.asset.dom.Property) LocalDate(org.joda.time.LocalDate) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Aggregations

List (java.util.List)12 FinderInteraction (org.incode.module.unittestsupport.dom.repo.FinderInteraction)12 Before (org.junit.Before)12 LocalDate (org.joda.time.LocalDate)7 Property (org.estatio.module.asset.dom.Property)4 PartyForTesting (org.estatio.module.party.dom.PartyForTesting)4 AgreementType (org.estatio.module.agreement.dom.type.AgreementType)2 InvoiceRepository (org.estatio.module.invoice.dom.InvoiceRepository)2 Lease (org.estatio.module.lease.dom.Lease)2 FixturesInstallingEvent (org.apache.isis.applib.events.system.FixturesInstallingEvent)1 Bookmark (org.apache.isis.applib.services.bookmark.Bookmark)1 ClockService (org.apache.isis.applib.services.clock.ClockService)1 FixtureScriptsDefault (org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault)1 QueryResultsCache (org.apache.isis.applib.services.queryresultscache.QueryResultsCache)1 AgreementRoleType (org.estatio.module.agreement.dom.role.AgreementRoleType)1 EstatioApplicationTenancyRepositoryForProperty (org.estatio.module.asset.dom.EstatioApplicationTenancyRepositoryForProperty)1 FixedAssetForTesting (org.estatio.module.asset.dom.FixedAssetForTesting)1 PropertyRepository (org.estatio.module.asset.dom.PropertyRepository)1 Unit (org.estatio.module.asset.dom.Unit)1 FixedAssetRoleRepository (org.estatio.module.asset.dom.role.FixedAssetRoleRepository)1