does anyone have an idea how i can remove the dupl...
# strikt
c
d
Derive SetDC and ListDC properties from a base class with Collection type, and use the same test with different input class type?
c
but they are data classes...
i could convert them to a class that takes collection before asserting. but it all feels wrong
d
Data classes can inherit from an interface, and all your tests are on collection size...
So you have a list of that interface with setdc and listdc in it with a forEach and run the tests inside it
Or make a custom assertion that takes a Collection of that interface, and do the assertion there
c
all great suggestions, thanks
d
Little note you might already be aware of, in your case it might be clearer to leave it as is, I only work harder to deduplicate when I have alot of tests to run that will benefit, it clarifies the tests' intention, or protects the tests from implementation details to make management easier... but sometimes abstractions can actually reduce test readability.
c
yeah, also very true