Skip to content

NPE in concrete processing static field  #432

Closed
@Damtev

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:

public static void concreteStaticFieldAsFirstStatement() {
    System.out.println(0);
}

Expected behavior

One test is generated, which does nothing:

@Test
@DisplayName("concreteStaticFieldAsFirstStatement: -> PrintStreamPrintln")
public void testConcreteStaticFieldAsFirstStatement_PrintStreamPrintln() {
    HelloWorld.concreteStaticFieldAsFirstStatement();
}

**Actual behavior**

One error method is generated:

```java
public void testConcreteStaticFieldAsFirstStatement_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