Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
acf6668
TKit.PathSnapshot: minor change and typoes fixed
alexeysemenyukoracle Oct 15, 2025
233b56d
Use `--release 11` javac option to compile test app
alexeysemenyukoracle Oct 7, 2025
8ed0b4d
AddLShortcutTest: make it work with the default fake runtime
alexeysemenyukoracle Oct 12, 2025
e58e2ce
Add ObjectMapper: map any object into a property map; fully functiona…
alexeysemenyukoracle May 13, 2025
a26454d
Add misc JUnitUtils test utils class with tests
alexeysemenyukoracle Jun 6, 2025
5f82671
LicenseTest, RuntimePackageTest: minor fixes
alexeysemenyukoracle Oct 16, 2025
b5aaa08
AdditionalLauncher: make getAdditionalLauncherProperties() public; La…
alexeysemenyukoracle Oct 17, 2025
179b7c2
AppImagePackageTest: make it produce a valid mac bundle to leverage t…
alexeysemenyukoracle Oct 17, 2025
b5798c7
LinuxHelper: revamp
alexeysemenyukoracle Oct 17, 2025
0431dae
Fix the merge
alexeysemenyukoracle Oct 17, 2025
29b24f6
ApplicationLayout: runtime layout should have a valid "runtimeHome" p…
alexeysemenyukoracle Oct 17, 2025
a8737f3
Move IdentityWrapper to jdk.jpackage.internal.util package for later …
alexeysemenyukoracle Oct 17, 2025
6ca539a
IdentityWrapper: trim trailing whitespace
alexeysemenyukoracle Oct 17, 2025
990cb4f
jpackage test lib: assorted improvements; LinuxHelper: validate "Comm…
alexeysemenyukoracle Oct 20, 2025
520a2d3
AppImagePackageTest: better logging; ObjectMapper: fix a warning
alexeysemenyukoracle Oct 18, 2025
cad3e78
AddLauncherTest: add test cases for the main/additional launcher desc…
alexeysemenyukoracle Oct 20, 2025
4b1f6bd
ObjectMapper: fix a typo
alexeysemenyukoracle Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.jpackage.internal.util;

import java.util.Objects;

/**
* Object wrapper implementing {@link Object#equals(Object)} such that it
* returns {@code true} only when the argument is another instance of this class
* wrapping the same object.
* <p>
* The class guarantees that {@link Object#equals(Object)} and
* {@link Object#hashCode()} methods of the wrapped object will never be called
* inside of the class methods.
*
* @param <T> the type of the wrapped value
*/
public final class IdentityWrapper<T> {

public IdentityWrapper(T value) {
this.value = Objects.requireNonNull(value);
}

public T value() {
return value;
}

@Override
public int hashCode() {
return System.identityHashCode(value);
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
var other = (IdentityWrapper<?>) obj;
return value == other.value;
}

@Override
public String toString() {
return String.format("Identity[%s]", value);
}

private final T value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.jpackage.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.Map;
import org.junit.jupiter.api.Test;

public class JUnitUtilsTest {

@Test
public void test_assertArrayEquals() {
JUnitUtils.assertArrayEquals(new int[] {1, 2, 3}, new int[] {1, 2, 3});
JUnitUtils.assertArrayEquals(new long[] {1, 2, 3}, new long[] {1, 2, 3});
JUnitUtils.assertArrayEquals(new boolean[] {true, true}, new boolean[] {true, true});
}

@Test
public void test_assertArrayEquals_negative() {
assertThrows(AssertionError.class, () -> {
JUnitUtils.assertArrayEquals(new int[] {1, 2, 3}, new int[] {2, 3});
});
}

@Test
public void test_exceptionAsPropertyMapWithMessageWithoutCause() {

var ex = new Exception("foo");

var map = JUnitUtils.exceptionAsPropertyMap(ex);

assertEquals(Map.of("getClass", Exception.class.getName(), "getMessage", "foo"), map);
}
}
Loading