-2
I am creating loading objects to perform unit tests, but the object I am working for is null as shown in the red arrow below, on line 39, and I can’t understand why this is happening, I need help to fix this bug!;
The code is here;
public class TipoIndicioBuilder {
private TipoIndicioEntity tipoIndicio;
private TipoIndicioBuilder() {
}
public static TipoIndicioBuilder umTipoIndicio() {
GrupoTipoIndicioEntity grupoTipoIndicio = new GrupoTipoIndicioEntity();
grupoTipoIndicio.setCodigo(1);
UsuarioCorporativoEntity usuarioCorporativo = new UsuarioCorporativoEntity();
usuarioCorporativo.setCodigo(1);
TipoIndicioBuilder builderTipoIndicio = new TipoIndicioBuilder();
builderTipoIndicio.tipoIndicio.setCodigo(16);
builderTipoIndicio.tipoIndicio.setNome("Acumulação2");
builderTipoIndicio.tipoIndicio.setDescricao("Ligado2");
builderTipoIndicio.tipoIndicio.setCriterio("oi tudo bem 2");
builderTipoIndicio.tipoIndicio.setPrazoPadrao(20);
builderTipoIndicio.tipoIndicio.getGrupo();
builderTipoIndicio.tipoIndicio.getUsuarioResponsavel();
return builderTipoIndicio;
}
public TipoIndicioEntity retornandoTipoIndicio() {
return tipoIndicio;
}
}
"How to fix NULL object bug?" it may seem strange to say this but... it is simple, if it is null just instantiate the object
– Ricardo Pontual