On Sat, Oct 9, 2021 at 7:26 PM Karl-Philipp Richter <[email protected]>
wrote:

> Hi,
> I wanted to contribute some unit tests to the project. As far I
> understand there's no mocking framework in use currently looking at the
> test classes and answers to my recent "Getting Started" post.
>
> I think this is odd and a framework should be introduced quickly. I
> recommend Mockito. If you don't believe it's useful try writing a unit
> test which passes a reference to
> org.netbeans.modules.parsing.spi.indexing.Indexable to a unit under
> test. In under two minutes. This should take seconds.
>

I guess something like this could work:
org.netbeans.modules.parsing.impl.indexing.SPIAccessor.getInstance().create(<some
indexable impl>);
e.g.:
org.netbeans.modules.parsing.impl.indexing.SPIAccessor.getInstance().create(new
IndexableImpl() {...});
or possibly more useful in many cases:
org.netbeans.modules.parsing.impl.indexing.SPIAccessor.getInstance().create(new
FileObjectIndexable(<root>, <file>));

I have nothing against mocking libraries, but I wonder what exactly is the
test for which an instance of Indexable is created. There are some tests
that use the SPIAccessor...create(new FileObjectIndexable(...)) path[1],
but the setup they do is much more complex than just creating an instance
of Indexable.

Thanks,
    Jan

[1]
https://github.com/apache/netbeans/blob/f2ca686da8852fa06b3eb7521cf1ef727e4182c7/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java#L214


> So far, I don't know how you measure coverage and what your requirements
> for minimal coverage are for new code and bugfixes is. High coverage
> isn't a guarantee for maintainable code and a high quality product,
> however low coverage in a safe indicator for the opposite. Having a
> mocking framework available and promoting it for new code in reviews
> will increase your development speed and reduce bugs severely.
>
> I'm opening a different thread from my "Getting Started" post since it's
> a more concrete issue.
>
> -Kalle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

Reply via email to