package com.github.tomaszglinski.acropyga.metadata.parsing;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class FormatParserTest {
    private FormatParser parser = new FormatParser();

    @Test
    public void testFound() {

	String comment = "# first line\n# second @env @format integer \n# third";

	SinglePropertyMetadataParserResult result = parser.parse(comment);

	assertEquals("integer", result.getMetadata().getValue());
	assertEquals("format", result.getMetadata().getMetadataId());
	assertEquals("# first line\n# second @env \n# third",
		result.getReducedComment());
    }

    @Test
    public void testNotFound() {

	String comment = "# first line\n# second @something\n# third";

	SinglePropertyMetadataParserResult result = parser.parse(comment);

	assertEquals(null, result.getMetadata().getValue());
    }

}
