UnitTestBot / UnitTestBot/usvm

NullPointerException is expected as a result of the correct test

Open
#109 2 comments 0 reactions 1 assignee View on GitHub

@Damtev is already working on this.

Since Nov 15, 2023.

bug
Dominant language
Kotlin
Stars
33
Forks
27
Avg merge
4d 3h
Merged PRs (30d)
15

Description

Generate tests in the following configuration:

timeLimit=60
methodFilter = "org.usvm.samples.primitives.IntExamples.*"
projectFilter = listOf("samples")

There are two tests for the function isInteger. They have the same input. One of them is incorrect.

///region Test suites for executable org.usvm.samples.primitives.IntExamples.isInteger
    
    
    /**
     * @utbot.classUnderTest {@link org.usvm.samples.primitives.IntExamples}
     * @utbot.methodUnderTest {@link org.usvm.samples.primitives.IntExamples#isInteger(java.lang.String)}
     */
    @Test
    public void testIsIntegerReturnsFalse() {
        boolean actual = IntExamples.isInteger(null);
        
        assertFalse(actual);
    }
    
    /**
     * @utbot.classUnderTest {@link org.usvm.samples.primitives.IntExamples}
     * @utbot.methodUnderTest {@link org.usvm.samples.primitives.IntExamples#isInteger(java.lang.String)}
     */
    @Test(expected = NullPointerException.class)
    public void testIsIntegerThrowsNPE() {
        IntExamples.isInteger(null);
    }
    
    ///endregion

It seems that erronous NPE comes from the JcState

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.