Skip to content

Add null check.#80

Merged
samadpaydar3 merged 2 commits into2.xfrom
fix_npe_issues_found_by_randoop
Feb 26, 2025
Merged

Add null check.#80
samadpaydar3 merged 2 commits into2.xfrom
fix_npe_issues_found_by_randoop

Conversation

@samadpaydar3
Copy link
Contributor

@samadpaydar3 samadpaydar3 commented Feb 26, 2025

Add null check to prevent methods throwing NullPointerException.
This was detected by unit tests auto-generated by Randoop. It is generally considered a bad practice for a method to be called by non-null arguments but throw NullPointerException. Below, is one of these tests:

    @Test
    public void test001() throws Throwable {
        if (debug)
            System.out.format("%n%s%n", "ErrorTest0.test001");
        com.laserfiche.api.client.apiserver.TokenClientImpl tokenClientImpl1 = new com.laserfiche.api.client.apiserver.TokenClientImpl("");
        com.laserfiche.api.client.model.CreateConnectionRequest createConnectionRequest3 = new com.laserfiche.api.client.model.CreateConnectionRequest();
        java.lang.String str4 = createConnectionRequest3.getPassword();
        createConnectionRequest3.setUsername("https://signin.hi!/oauth/");
        // during test generation this statement threw an exception of type java.lang.NullPointerException in error
        com.laserfiche.api.client.model.SessionKeyInfo sessionKeyInfo7 = tokenClientImpl1.createAccessToken("", createConnectionRequest3);
    }

@github-actions
Copy link
Contributor

unit-test-results

46 tests  ±0   45 ✅ ±0   1s ⏱️ ±0s
 8 suites ±0    1 💤 ±0 
 8 files   ±0    0 ❌ ±0 

Results for commit dd37101. ± Comparison against base commit b77abdb.

@github-actions
Copy link
Contributor

integration-test-results-cloud

14 tests  ±0   14 ✅ ±0   9s ⏱️ -1s
 2 suites ±0    0 💤 ±0 
 2 files   ±0    0 ❌ ±0 

Results for commit dd37101. ± Comparison against base commit b77abdb.

@github-actions
Copy link
Contributor

integration-test-results-self-hosted

6 tests  ±0   6 ✅ ±0   12s ⏱️ -1s
1 suites ±0   0 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit dd37101. ± Comparison against base commit b77abdb.

@samadpaydar3 samadpaydar3 merged commit 9b127c2 into 2.x Feb 26, 2025
7 checks passed
@samadpaydar3 samadpaydar3 deleted the fix_npe_issues_found_by_randoop branch February 26, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants