I had issues with an oxygen sensor on my Holden Camira (4 cylinder station wagon). I went and had it replaced at an exhaust place and they used an aftermarket sensor. The check engine light came on when I was driving home. A few months later the sensor crapped itself and I went to my mechanic and forked out another couple of hundred to get a genuine sensor fitted. The check engine light went out and didn't come back on.
I would not spend that much on anything with my cars.....I am far too stingy
On the occasion when asked "why is this or that sensor/light not working" etc
"Sorry mate, this is how I bought the car" or "Nah mate, the car is the older model, never had one of those fitted" The cars always had my private plates on them and were grey imports so unless the tester was a real jobsworth, they wouldn't bother checking the model or year on it and just accepted my word.
I do admit that since I always did my own maintenance and engine rebuilds anyway and on testing day, I always turned up at the testing station in my oily overalls with greasy hands.
My last car, a single Turbo Toyota Supra, had a full one-piece stainless steel Mongoose and it meant that a number of sensors etc accidently on purpose got binned....basically cos I did not want to cut the system and certain parts of the engine and mounts had to be skillfully altered to make things fit. I had so much fun with that car on testing day....the old noxious gas tester clipped to the 5 inch diameter rear exhaust can....touch that throttle at that gas tester took flying lessons. (My best mate's son also used the car to take his driving test in too...and he passed first time)
I used to LOVE pulling the wool over a vehicle tester's eyes......half of the stuff under the bonnet of a car thesedays is not needed. Those stupid vanity panels that cover everything up and make it look "nice", they come off right away cos I liked to actually SEE my engine and be able to check water, oil etc without having to striptease the engine compartment first. If I could have binned the damned computerised engine management system, I would have done. Give me a bog standard, easy to work on old fashioned bare V8 any day of the week. Can't be doing with computerised engine management nonsense, I remap and strip it as much as I can.
My cars were always legal...noisy thanks to the Mongoose...but totally legal