Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in concrete processing static field #432

Closed
Damtev opened this issue Jul 6, 2022 · 0 comments · Fixed by #433
Closed

NPE in concrete processing static field #432

Damtev opened this issue Jul 6, 2022 · 0 comments · Fixed by #433
Assignees
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug Issue is a bug

Comments

@Damtev
Copy link
Member

Damtev commented Jul 6, 2022

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

@Damtev Damtev added ctg-bug Issue is a bug comp-symbolic-engine Issue is related to the symbolic execution engine labels Jul 6, 2022
@Damtev Damtev self-assigned this Jul 6, 2022
@Damtev Damtev added this to UTBot Java Jul 6, 2022
@Damtev Damtev moved this to Todo in UTBot Java Jul 6, 2022
@Damtev Damtev moved this from Todo to In Progress in UTBot Java Jul 6, 2022
Repository owner moved this from In Progress to Done in UTBot Java Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant