Added throw Exception to method getSimplifyResultsByName

This commit is contained in:
Fayez Abu Alia 2019-07-31 10:33:43 +02:00
parent eed8f32cb7
commit efdb58e67c

View File

@ -40,11 +40,11 @@ public class GenericGenratorResultForSourceFile {
public GenericsGeneratorResultForClass getSimplifyResultsByName(String pkgName, String name) {
if (this.pkgName.equals(pkgName)) {
return genericGeneratorResultForAllClasses
.stream()
return genericGeneratorResultForAllClasses.stream()
.filter(sr -> sr.getClassName().equals(name))
.findAny()
.orElse(new GenericsGeneratorResultForClass(name));
.orElseThrow(() -> new NoSuchElementException(
"Simplify results for the class " + pkgName + "." + name + " are not found"));
}
throw new NoSuchElementException("Simplify results for the class " + pkgName + "." + name + " are not found");
}