/**
 * Copyright (c) 2016, German Neuroinformatics Node (G-Node)
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted under the terms of the BSD License. See
 * LICENSE file in the root of the Project.
 */

package org.g_node.micro.commons;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;

/**
 * Unit tests for the {@link AppUtils} class.
 *
 * @author Michael Sonntag (sonntag@bio.lmu.de)
 */
public final class AppUtilsTest {

    /**
     * Method checks that the {@link AppUtils} getHashSHA method returns
     * the proper hex hash for a List of String entries.
     */
    @Test
    public void testGetHashSHA() {
        final String checkHexSHA = "e5c055cdf43af5be8972d5a94c8d0182296de89b";

        final ArrayList<String> testHashLower = new ArrayList<>(Arrays.asList("hash", "me"));
        assertThat(checkHexSHA.equals(AppUtils.getHashSHA(testHashLower))).isTrue();

        final ArrayList<String> testHashMixed = new ArrayList<>(Arrays.asList("Hash", "Me"));
        assertThat(checkHexSHA.equals(AppUtils.getHashSHA(testHashMixed))).isTrue();

        final List<String> testHashSingleEntry = Collections.singletonList("Hash me");
        assertThat(checkHexSHA.equals(AppUtils.getHashSHA(testHashSingleEntry))).isTrue();

        final List<String> testDiff = Collections.singletonList("hashme");
        assertThat(checkHexSHA.equals(AppUtils.getHashSHA(testDiff))).isFalse();
    }

}

@@ -477,16 +477,78 @@
 rtThat;%0A
+import static org.assertj.core.api.Assertions.catchThrowable;%0A
 import o
@@ -1676,10 +1676,982 @@
 %0A    %7D%0A%0A
+    /**%0A     * Test checks via regular expression that the method returns a valid timestamp.%0A     * Further checks that a proper exception is thrown if a Non-DateTimeFormatter pattern is used.%0A     */%0A    @Test%0A    public void testGetTimeStamp() throws Exception %7B%0A        final String testFormat = %22dd.MM.yyyy HH:mm%22;%0A        final String regEx = String.join(%22%22,%0A                %22(%5B0%5D%5B1-9%5D%7C%5B1-2%5D%5B0-9%5D%7C%5B3%5D%5B0-1%5D).(%5B0%5D%5B1-9%5D%7C%5B1%5D%5B0-2%5D).(20%5C%5Cd%5C%5Cd) %22,%0A                %22(%5B0-1%5D%5B0-9%5D%7C%5B2%5D%5B0-3%5D):%5B0-5%5D%5B0-9%5D%22);%0A%0A        final String getFormattedTimeStamp = AppUtils.getTimeStamp(testFormat);%0A        assertThat(getFormattedTimeStamp).matches(regEx);%0A%0A        final String testInvalidFormat = %22something definitely not dateTime%22;%0A        Throwable thrown = catchThrowable(() -%3E AppUtils.getTimeStamp(testInvalidFormat));%0A        assertThat(thrown)%0A                .isInstanceOf(IllegalArgumentException.class)%0A                .hasMessageContaining(%22Unknown pattern letter: o%22);%0A    %7D%0A%0A
 %7D%0A

Add AppUtils getTimeStamp test