You can do it directly in
find; no need to involve
With a directory structure like:
$ ls *
GNU find command will pick out files ending in
.java in directories in the current working directory that contain the word
sensors, but does not end in
.test (if I interpreted your question correctly):
$ find -type f -ipath './*sensors*' -not -ipath './*.test/*' -iname '*.java'
man find should explain the switches clearly and probably better than I would.
Piping is powerful, but the base tools handle many scenarios by themselves in a more straightforward manner. This avoids unnecessary process forks and keeps subtle errors to a minimum.