Skip to content

Empty test class is generated for Socket.connect with added permissions #1499

Closed
@alisevych

Description

@alisevych

Description

Empty test class is generated for Socket.connect with added permissions for Java Security manager

**Steps to reproduce

  1. Add the following file to the ~/.utbot : sandbox.policy:
grant {
    permission java.net.SocketPermission "*", "connect";
};
  1. Generate tests with Symbolic engine 95% (default settings) for the following code:
    public int connect(Socket socket) throws IOException {
        socket.connect(new InetSocketAddress("0.0.0.0", 22));
        return 0;
    }

Expected behavior

There are some test methods inside the generated class.
Or - there is an error message that no tests were generated - see Additional context

Actual behavior

Empty test class is generated - without comments.

Visual proofs

public final class ATest {
}

Additional context

If Symbolic execution method is set to 100% (File > Settings > Tools > UnitTestBot), there are no tests generated and error message is shown:

image

Originally posted by @alisevych in #1425 (comment)

Metadata

Metadata

Assignees

Labels

comp-codegenIssue is related to code generatorctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions