aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/utils/LogTemplateProviderTest.java
blob: a7dcb2b1266e2e4a1f412d6f08540e31251b93a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package cgeo.geocaching.utils;

import static org.assertj.core.api.Assertions.assertThat;

import cgeo.geocaching.utils.LogTemplateProvider.LogContext;

import java.util.Calendar;

import junit.framework.TestCase;

public class LogTemplateProviderTest extends TestCase {

    public static void testApplyTemplates() {
        final String noTemplates = " no templates ";
        assertEquals(noTemplates, LogTemplateProvider.applyTemplates(noTemplates, new LogContext(null, null, true)));

        // This test can occasionally fail if the current year changes right after the next line.
        final String currentYear = Integer.toString(Calendar.YEAR);
        assertThat(LogTemplateProvider.applyTemplates("[DATE]", new LogContext(null, null, true)).contains(currentYear)).isTrue();
    }

}