Skip to content

A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.

1.1 KB
Raw Blame
package opensuite.ui;

import opensuite.testkit.Expect;
import opensuite.testkit.Harness;

/**
 * A restart from inside a packaged Linux build starts the package again, and its start script
 * chooses the scale afresh. For that the scale the script set the first time has to come out
 * of the options handed on, while anything the user set themselves stays.
 */
public final class RestartOptionsTest {
    public void run() {
        Harness.suite("restart options");

        Harness.test("the start script's own scale is taken out", () -> {
            Expect.equal(UiScale.withoutOwnScale("-Dfoo=1 -Dsun.java2d.uiScale=2 -Dopensuite.scaled=2 -Xmx900m"), "-Dfoo=1 -Xmx900m", "pair removed, the rest kept");
            Expect.equal(UiScale.withoutOwnScale("-Dsun.java2d.uiScale=1.5 -Dopensuite.scaled=1.5"), "", "nothing left");
        });

        Harness.test("a scale the user set by hand is kept", () -> {
            Expect.equal(UiScale.withoutOwnScale("-Dsun.java2d.uiScale=2"), "-Dsun.java2d.uiScale=2", "no marker of ours, so it is theirs");
            Expect.equal(UiScale.withoutOwnScale(null), "", "no options at all");
        });
    }
}