GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java.lang.UnsatisfiedLinkError: no awt in java.library.path · Issue #714 · UnitTestBot/UTBotJava

java.lang.UnsatisfiedLinkError: no awt in java.library.path #714

New issue
Copy link
New issue
Copy link
Closed
#1124
Closed
java.lang.UnsatisfiedLinkError: no awt in java.library.path#714
#1124
Copy link
Assignees
SBOne-Kenobi
Labels
ctg-bugIssue is a bugIssue is a bug
Milestone
2022.11 Release

Description

@dvfedrush
dvfedrush
opened on Aug 11, 2022
Issue body actions

Description

Couldn't generate some tests. Errors -> java.lang.UnsatisfiedLinkError: no awt in java.library.path

To Reproduce

Try to generate tests for a following class:

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class Solution672916 {
    /**
     * get image height and width using java
     */
    public int[] func_1(String filename) throws IOException {
        BufferedImage bimg = ImageIO.read(new File(filename));
        return new int[] {bimg.getHeight(), bimg.getWidth()};
    }
}

Expected behavior

Generated any tests (mocking BufferedImage)

Actual behavior

import org.junit.Test;

import java.io.IOException;

public class Solution672916Test {
    ///region Test suites for executable com.huawei.sof.benchmark.Solution672916.func_1

    ///region

    @Test(timeout = 50L)
    //@org.junit.jupiter.api.DisplayName("func_1: filename = blank string")
    public void testFunc_1WithBlankString() throws IOException {
        Solution672916 solution672916 = new Solution672916();
        
        /* This execution may take longer than the 50 ms timeout
         and therefore fail due to exceeding the timeout. */
        solution672916.func_1("   ");
    }

    @Test(expected = NoClassDefFoundError.class)
    //@org.junit.jupiter.api.DisplayName("func_1: filename has special characters -> throw NoClassDefFoundError")
    public void testFunc_1ThrowsNCDFEWithBlankString() throws IOException {
        Solution672916 solution672916 = new Solution672916();

        solution672916.func_1("\n\t\r");
    }
    ///endregion

    ///region ERROR SUITE for method func_1(java.lang.String)

    /**
     * <pre>
     * Test
     * throws NullPointerException in: BufferedImage bimg = ImageIO.read(new File(filename));
     * </pre>
     */
    @Test(expected = NullPointerException.class)
    //@org.junit.jupiter.api.DisplayName("func_1: bimg = ImageIO.read(new File(filename)) : True -> ThrowNullPointerException")
    public void testFunc_1_ThrowNullPointerException() throws IOException {
        Solution672916 solution672916 = new Solution672916();

        solution672916.func_1(null);
    }
    ///endregion

    ///region Errors report for func_1

    public void testFunc_1_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 2 occurrences of:
        /* Error in the child process |> java.lang.IllegalStateException: No field $__is_mock_null
        in class javax.imageio.ImageIO
        		at org.utbot.framework.concrete.MethodMockController.<init>(MethodMockController.kt:37)
        		at org.utbot.framework.concrete.MockValueConstructor.mockMethods(MockValueConstructor.kt:247)
        		at org.utbot.framework.concrete.MockValueConstructor.mockStaticMethods(MockValueConstructor.kt:265)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1.invoke(UtExecutionInstrumentation.kt:155)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1.invoke(UtExecutionInstrumentation.kt:107)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation.withStaticFields(UtExecutionInstrumentation.kt:269)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:153)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107)
        		at org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)
        		at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)
        		at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)
        	 */

        // 1 occurrences of:
        /* Error in the child process |> java.lang.UnsatisfiedLinkError: no awt in
        java.library.path
        		at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
        		at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
        		at java.base/java.lang.System.loadLibrary(System.java:1867)
        		at java.desktop/java.awt.image.ColorModel$1.run(ColorModel.java:209)
        		at java.desktop/java.awt.image.ColorModel$1.run(ColorModel.java:207)
        		at java.base/java.security.AccessController.doPrivileged(Native Method)
        		at java.desktop/java.awt.image.ColorModel.loadLibraries(ColorModel.java:206)
        		at java.desktop/java.awt.image.ColorModel.<clinit>(ColorModel.java:219)
        		at java.desktop/java.awt.image.BufferedImage.<clinit>(BufferedImage.java:286)
        		at java.base/jdk.internal.misc.Unsafe.allocateInstance(Native Method)
        		at jdk.unsupported/sun.misc.Unsafe.allocateInstance(Unsafe.java:840)
        		at org.utbot.framework.util.EngineUtilsKt.getAnyInstance(EngineUtils.kt:35)
        		at org.utbot.framework.concrete.MockValueConstructor.constructObject(MockValueConstructor.kt:161)
        		at org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:127)
        		at org.utbot.framework.concrete.MockValueConstructor.mockAndGet(MockValueConstructor.kt:433)
        		at org.utbot.framework.concrete.MockValueConstructor.computeConcreteValuesForMethods(MockValueConstructor.kt:226)
        		at org.utbot.framework.concrete.MockValueConstructor.mockMethods(MockValueConstructor.kt:243)
        		at org.utbot.framework.concrete.MockValueConstructor.mockStaticMethods(MockValueConstructor.kt:265)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1.invoke(UtExecutionInstrumentation.kt:155)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1.invoke(UtExecutionInstrumentation.kt:107)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation.withStaticFields(UtExecutionInstrumentation.kt:269)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:153)
        		at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107)
        		at org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)
        		at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)
        		at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)
        	 */

        // 1 occurrences of:
        // Concrete execution failed

    }
    ///endregion

    ///endregion

}

Environment

Jdk 8/11, Idea 2021.1 x64
image

Activity

  1. korifey
    added this to UTBot Javaon Aug 11, 2022
  2. korifey
    moved this to Todo in UTBot Javaon Aug 11, 2022
  3. alisevych
    added
    ctg-bugIssue is a bugIssue is a bug
    on Aug 15, 2022
  4. alisevych commented on Aug 15, 2022

    @alisevych
    alisevych
    on Aug 15, 2022
    Member
    More actions

    Reproduced on the build from main on 8/15/2022
    The differences in the current version of the plugin is that:

    • the test class doesn't contain error report
    • the same exception is saved in the concrete execution log
  5. alisevych
    assigned
    SBOne-Kenobi
    on Aug 15, 2022
  6. SBOne-Kenobi commented on Aug 18, 2022

    @SBOne-Kenobi
    SBOne-Kenobi
    on Aug 18, 2022
    Contributor
    More actions

    On my laptop awt library was found in child process. ImageIO was tried to mock by symbolic engine but ImageIO was not instrumented. Concrete executor log.

    • need to research awt library location in IDEA or extend environment requirements with installing awt library
    • need to find out possibility of mocking awt classes
  7. alisevych
    added this to the Release preparation milestone on Sep 7, 2022
  8. JaneEugenia
    moved this from Todo to In Progress in UTBot Javaon Sep 8, 2022
  9. JaneEugenia
    moved this from In Progress to Done in UTBot Javaon Sep 12, 2022
  10. alisevych
    modified the milestones: Release preparation, 2022.12 Release on Oct 7, 2022
  11. SBOne-Kenobi
    closed this as completedin #1124on Oct 10, 2022
  12. alisevych
    modified the milestones: 2022.12 Release, 2022.10 Release preparation on Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @SBOne-Kenobi
    SBOne-Kenobi

Labels

ctg-bugIssue is a bugIssue is a bug

Type

No type

Projects

  • UTBot Java
    Status
    Done
    Show more project fields

Milestone

  • 2022.11 Release

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.