package cgeo.geocaching;

import junit.framework.TestCase;

public class LogTemplateProviderTest extends TestCase {

    public static void testApplyTemplates() {
        final String noTemplates = " no templates ";
        assertEquals(noTemplates, LogTemplateProvider.applyTemplates(noTemplates, true));
        assertTrue(LogTemplateProvider.applyTemplates("[DATE]", true).contains("."));
    }

}

package cgeo.geocaching;

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, true));

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

}

Fix text by requiring the current year to be present in output