Code Monkey home page Code Monkey logo

Comments (2)

cropredyHelix avatar cropredyHelix commented on May 27, 2024 1

After some inspired searching on frup42 blog, I now see how to use fflib_ArgumentCaptor to solve the above on verifying maps. Still seems as if there should be enhancement possibilities for more matchers on fflib_Match to deal with sets.

from fflib-apex-mocks.

dfruddffdc avatar dfruddffdc commented on May 27, 2024

Another Apex quirk... This compiles fine:

List<Account> records = new List<Account>{};
List<Object> castUp = (List<Object>)records;
List<Account> castDown = (List<Account>)castUp;

But this doesn't compile, because: Incompatible types since an instance of Set is never an instance of Set

Set<Account> records = new Set<Account>{};
Set<Object> castUp = (Set<Object>)records;
Set<Account> castDown = (Set<Account>)castUp;

Likewise with Maps. So we can't write generic matchers for Maps and Sets, we have to have a specific matcher for the specific Typed Maps/Sets. This would be a lot of matchers, but not particularly useful for the majority of ApexMocks consumers.

So when the requirement comes up, we just let the consumer use captors or custom matchers knowing the specific Types in question in their test.

from fflib-apex-mocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.