Coder Social home page Coder Social logo

Comments (4)

jamessimone avatar jamessimone commented on June 13, 2024 1

@derroman ah, interesting find! My apologies for not catching this, the repo has a slightly different version of Query than I use in prod but that’s my fault for not checking the quote wrapping for Ids. Your fix is a good one - I will incorporate it shortly!

from apex-dml-mocking.

jamessimone avatar jamessimone commented on June 13, 2024 1

@derroman this is now resolved. This was an interesting opportunity to delve into toString()'s base implementation - apparently, calling toString() on a Set adds spaces between the different entries; it's possible that the List class does this as well, but there it is obfuscated by an oddity singular to Set - it is an Iterable (you can use it in a for loop, after all), but it does not publicly show that. Most objects you can call instanceof to detect what they are, which is how the string parsing in the Query class works. However, from my previous work on this (as part of the Nebula Framework), I knew that Sets do not test true for being an Iterable, which is why they are handled separately to begin with.

Long story short - I shot myself in the foot by having a test involving Sets with multiple Ids ... but the Ids that I was using had the same value. I was able to easily reproduce your issue in the existing test that I have purely by updating the test to include a second unique Id. That was a tragic oversight on my part; it was fine to use the same Id for testing that Lists worked with this newer implementation, but of course the same value being added to a Set just reduces it to a single value.

Thanks for bringing this to my attention, and for using this framework!

from apex-dml-mocking.

derroman avatar derroman commented on June 13, 2024

But just for fun and because I did not find the time yet (a.k.a "too lazy to debug" ;-) ):

Why does this happen in the first place?

from apex-dml-mocking.

derroman avatar derroman commented on June 13, 2024

@jamessimone great and thanks for the interesting explanation!

from apex-dml-mocking.

Related Issues (12)

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.