@@ -0,0 +1,1649 @@
+/**%0A * Copyright (c) 2015, German Neuroinformatics Node (G-Node)%0A *%0A * All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted under the terms of the BSD License. See%0A * LICENSE file in the root of the Project.%0A */%0A%0Apackage org.g_node.srv;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0A/**%0A * Unit tests for the %7B@link Utils%7D class.%0A *%0A * @author Michael Sonntag (sonntag@bio.lmu.de)%0A */%0Apublic final class UtilsTest %7B%0A%0A    /**%0A     * Method checks that the %7B@link Utils%7D getHashSHA256 method returns%0A     * the proper hex hash for a List of String entries.%0A     */%0A    @Test%0A    public void testGetHashSHA256() %7B%0A        final String checkHexSHA256 = %22c82b1b9a0ef4f87e13050b542881d1d158014e6d575f8efa7c4e2043b8c0cdf1%22;%0A%0A        final ArrayList%3CString%3E testHashLower = new ArrayList%3C%3E(Arrays.asList(%22hash%22, %22me%22));%0A        assertThat(checkHexSHA256.equals(Utils.getHashSHA256(testHashLower))).isTrue();%0A%0A        final ArrayList%3CString%3E testHashMixed = new ArrayList%3C%3E(Arrays.asList(%22Hash%22, %22Me%22));%0A        assertThat(checkHexSHA256.equals(Utils.getHashSHA256(testHashMixed))).isTrue();%0A%0A        final List%3CString%3E testHashSingleEntry = Collections.singletonList(%22Hash me%22);%0A        assertThat(checkHexSHA256.equals(Utils.getHashSHA256(testHashSingleEntry))).isTrue();%0A%0A        final List%3CString%3E testDiff = Collections.singletonList(%22hashme%22);%0A        assertThat(checkHexSHA256.equals(Utils.getHashSHA256(testDiff))).isFalse();%0A    %7D%0A%7D%0A

test hash256 utility method