Skip to content

NPE in concrete processing static field  #432

Description

@Damtev

Description

If the first statement in MUT used a static field that should be processed concretely and which is not an enum, the engine emits UtError because of NullPointerException produced by environment.state.lastEdge == null.

To Reproduce

Try to generate a test for such a method:

publicstaticvoidconcreteStaticFieldAsFirstStatement() {
System.out.println(0);
}

Expected behavior

One test is generated, which does nothing:

@Test@DisplayName("concreteStaticFieldAsFirstStatement: -> PrintStreamPrintln")
publicvoidtestConcreteStaticFieldAsFirstStatement_PrintStreamPrintln() {
HelloWorld.concreteStaticFieldAsFirstStatement();
}
**Actualbehavior**
Oneerrormethodisgenerated:
```javapublicvoidtestConcreteStaticFieldAsFirstStatement_errors() {
// Couldn't generate some tests. List of errors:// // 1 occurrences of:// <Throwable with empty message>
}

Environment

Commit c09568f
Java, no mocks.

Additional context

Not applicable

Metadata

Metadata

Assignees

Labels

comp-symbolic-engineIssue is related to the symbolic execution enginectg-bugIssue is a bug

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions