001package com.ganteater.ae.processor;
002
003import static org.junit.Assert.*;
004
005import java.util.Arrays;
006import java.util.List;
007
008import org.junit.Test;
009
010public class CommandInfoTest {
011
012        @Test
013        public void constructor_shouldTrimNameAndStoreFields() {
014                // Arrange
015                String nameWithSpaces = "  Out  ";
016                String description = "Outputs a value";
017
018                // Act
019                CommandInfo info = new CommandInfo(nameWithSpaces, Processor.class, description);
020
021                // Assert
022                assertEquals("Out", info.getName());
023                assertEquals(description, info.getDescription());
024                assertEquals("Processor", info.getClassName());
025                assertEquals("Out", info.toString());
026        }
027
028        @Test
029        public void setExamples_shouldBeReturnedByGetter() {
030                // Arrange
031                CommandInfo info = new CommandInfo("X", Processor.class, "");
032                List<String> examples = Arrays.asList("<X/>", "<X a='b'/>");
033
034                // Act
035                info.setExamples(examples);
036
037                // Assert
038                assertSame(examples, info.getExamples());
039        }
040}