<commit_before>package cgeo.geocaching.location;

import org.junit.Assert;
import org.junit.Test;

/**
 * Test the UTMPoint parsing and formatting.
 */
public class UTMPointFormatTest {

    @Test
    public static void testParseUTMStringSimple() {
        final UTMPoint utm = new UTMPoint("54S 293848 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public static void testParseUTMStringWithEandN() {
        final UTMPoint utm = new UTMPoint("54S E 293848 N 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public static void testParseUTMStringWithDecimals() {
        final UTMPoint utm = new UTMPoint("54S 293848.4 3915114.5");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848.4, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114.5, utm.getNorthing(), 1.1d);
    }

    @Test
    public static void testParseUTMStringWithLowerCaseLetters() {
        final UTMPoint utm = new UTMPoint("54s e 293848 n 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public static void testParseUTMStringWithCommaAsDecimalSeparator() {
        final UTMPoint utm = new UTMPoint("54S 293848,4 3915114,5");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848.4, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114.5, utm.getNorthing(), 1.1d);
    }

    @Test
    public static void testParseUTMStringWithBlankAfterZoneNumber() {
        final UTMPoint utm = new UTMPoint("54 S 293848 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public static void testParseUTMStringWithSingleDigitZoneNumber() {
        final UTMPoint utm = new UTMPoint("5S 293848 3915114");

        Assert.assertEquals(5, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @SuppressWarnings("unused")
    @Test(expected = UTMPoint.ParseException.class)
    public static void testParseUTMStringWithException() {
        new UTMPoint("5S blah blub");
    }

    @Test
    public static void testToString() {
        Assert.assertEquals("54S E 293848 N 3915114", new UTMPoint(54, 'S', 293848, 3915114).toString());
    }

    @Test
    public static void testToStringWithRoundedDecimals() {
        Assert.assertEquals("54S E 293848 N 3915114", new UTMPoint(54, 'S', 293847.5, 3915114.3).toString());
    }

}<commit_msg>revert to non static test methods<commit_after>package cgeo.geocaching.location;

import org.junit.Assert;
import org.junit.Test;

/**
 * Test the UTMPoint parsing and formatting.
 */
public class UTMPointFormatTest {

    @Test
    public void testParseUTMStringSimple() {
        final UTMPoint utm = new UTMPoint("54S 293848 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public void testParseUTMStringWithEandN() {
        final UTMPoint utm = new UTMPoint("54S E 293848 N 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public void testParseUTMStringWithDecimals() {
        final UTMPoint utm = new UTMPoint("54S 293848.4 3915114.5");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848.4, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114.5, utm.getNorthing(), 1.1d);
    }

    @Test
    public void testParseUTMStringWithLowerCaseLetters() {
        final UTMPoint utm = new UTMPoint("54s e 293848 n 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public void testParseUTMStringWithCommaAsDecimalSeparator() {
        final UTMPoint utm = new UTMPoint("54S 293848,4 3915114,5");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848.4, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114.5, utm.getNorthing(), 1.1d);
    }

    @Test
    public void testParseUTMStringWithBlankAfterZoneNumber() {
        final UTMPoint utm = new UTMPoint("54 S 293848 3915114");

        Assert.assertEquals(54, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test
    public void testParseUTMStringWithSingleDigitZoneNumber() {
        final UTMPoint utm = new UTMPoint("5S 293848 3915114");

        Assert.assertEquals(5, utm.getZoneNumber());
        Assert.assertEquals('S', utm.getZoneLetter());
        Assert.assertEquals(293848, utm.getEasting(), 1.1d);
        Assert.assertEquals(3915114, utm.getNorthing(), 1.1d);
    }

    @Test(expected = UTMPoint.ParseException.class)
    public void testParseUTMStringWithException() {
        new UTMPoint("5S blah blub");
    }

    @Test
    public void testToString() {
        Assert.assertEquals("54S E 293848 N 3915114", new UTMPoint(54, 'S', 293848, 3915114).toString());
    }

    @Test
    public void testToStringWithRoundedDecimals() {
        Assert.assertEquals("54S E 293848 N 3915114", new UTMPoint(54, 'S', 293847.5, 3915114.3).toString());
    }

}
{'fraction_non_alphanumeric': 0.12899881516587677, 'fraction_numerical': 0.09093601895734597, 'mean_word_length': 3.2985359643539147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1215535', 'n_tokens_mistral': 2605, 'n_tokens_neox': 2182, 'n_words': 424}