mil.dod.th.ose.sdk/test/mil/dod/th/ose/sdk/those/TestProjectGenerator.java
@Test
    public void testCreateSerialPort() throws IOException, TemplateException
    {
        // Stubbing
        when(m_Config.getTemplate(bndTemplateName)).thenReturn(m_BundleTemplate);
        when(m_Config.getTemplate("ExamplePhysicalLink.java.ftl")).thenReturn(m_FactoryObjectJavaTemplate);
        when(m_Config.getTemplate("ExampleAssetScanner.java.ftl")).thenReturn(m_ScannerJavaTemplate);

        // Instantiated objects
        ProjectProperties projectProps = new ProjectProperties(null);
        projectProps.setProjectType(ProjectType.PROJECT_PHYLINK);
        projectProps.setPhysicalLinkTypeEnum(PhysicalLinkTypeEnum.SERIAL_PORT);
        final Map<String, Object> dataModel = projectProps.getProperties();
        PrintStream out = new PrintStream(System.out);
        ArgumentCaptor<Writer> outWriter = ArgumentCaptor.forClass(Writer.class);
        m_SUT.initialize(m_Config, out);

        // Method Call
        m_SUT.create(projectProps, m_ProjectDir);

        verifyCreation(dataModel, outWriter);
        verify(m_FileOutputStream).write(
                ProjectPhysicalLinkCapabilities.getCapabilities(PhysicalLinkTypeEnum.SERIAL_PORT));

        assertThat(projectProps.getProperties(), hasEntry(ProjectProperties.PROP_ATTR_TYPE, (Object)"SerialPort"));
        assertThat(projectProps.getProperties(), hasEntry(ProjectProperties.PROP_PROXY_TYPE, (Object)"SerialPort"));
        String serialPortCode = "@Override\n"
                + "    public void setDTR(final boolean high) throws UnsupportedOperationException\n" + "    {\n"
                + "        // ${task}: Method should adjust the data transmit ready pin based on the input. If\n"
                + "        // operation is supported, remove the throw below. If not supported, keep method as is.\n"
                + "\n" // NOCHECKSTYLE: repeated string literal, not worried about other copy keeping in sync
                + "        throw new UnsupportedOperationException(\"Platform does not support setting DTR\");\n"
                + "    }\n";
        assertThat(projectProps.getProperties(),
                hasEntry(ProjectProperties.PROP_PL_EXTRA_CODE, (Object)serialPortCode));
    }
/**
     * Test that creating a physical link plug-in project will process the correct files.
     * 
     * Verify the data model is correctly passed in to the process call.
     * 
     * Verify the correct BND template file and Java templates are used.
     */
Test that creating a physical link plug-in project will process the correct files.

Verify the data model is correctly passed in to the process call.

Verify the correct BND template file and Java templates are used.
Test that creating a physical link plug - in project will process the correct files . Verify the data model is correctly passed in to the process call . Verify the correct BND template file and Java templates are used .
@Test
    public void testCreateSerialPort() throws IOException, TemplateException
    {
        when(m_Config.getTemplate(bndTemplateName)).thenReturn(m_BundleTemplate);
        when(m_Config.getTemplate("ExamplePhysicalLink.java.ftl")).thenReturn(m_FactoryObjectJavaTemplate);
        when(m_Config.getTemplate("ExampleAssetScanner.java.ftl")).thenReturn(m_ScannerJavaTemplate);
        ProjectProperties projectProps = new ProjectProperties(null);
        projectProps.setProjectType(ProjectType.PROJECT_PHYLINK);
        projectProps.setPhysicalLinkTypeEnum(PhysicalLinkTypeEnum.SERIAL_PORT);
        final Map<String, Object> dataModel = projectProps.getProperties();
        PrintStream out = new PrintStream(System.out);
        ArgumentCaptor<Writer> outWriter = ArgumentCaptor.forClass(Writer.class);
        m_SUT.initialize(m_Config, out);
        m_SUT.create(projectProps, m_ProjectDir);
        verifyCreation(dataModel, outWriter);
        verify(m_FileOutputStream).write(
                ProjectPhysicalLinkCapabilities.getCapabilities(PhysicalLinkTypeEnum.SERIAL_PORT));
        assertThat(projectProps.getProperties(), hasEntry(ProjectProperties.PROP_ATTR_TYPE, (Object)"SerialPort"));
        assertThat(projectProps.getProperties(), hasEntry(ProjectProperties.PROP_PROXY_TYPE, (Object)"SerialPort"));
        String serialPortCode = "@Override\n"
                + "    public void setDTR(final boolean high) throws UnsupportedOperationException\n" + "    {\n"
                + "        // ${task}: Method should adjust the data transmit ready pin based on the input. If\n"
                + "        // operation is supported, remove the throw below. If not supported, keep method as is.\n"
                + "\n" 
                + "        throw new UnsupportedOperationException(\"Platform does not support setting DTR\");\n"
                + "    }\n";
        assertThat(projectProps.getProperties(),
                hasEntry(ProjectProperties.PROP_PL_EXTRA_CODE, (Object)serialPortCode));
    }
@ Test public void testCreateSerialPort ( ) throws IOException , TemplateException { when ( m_Config . getTemplate ( bndTemplateName ) ) . thenReturn ( m_BundleTemplate ) ; when ( m_Config . getTemplate ( "ExamplePhysicalLink.java.ftl" ) ) . thenReturn ( m_FactoryObjectJavaTemplate ) ; when ( m_Config . getTemplate ( "ExampleAssetScanner.java.ftl" ) ) . thenReturn ( m_ScannerJavaTemplate ) ; ProjectProperties projectProps = new ProjectProperties ( null ) ; projectProps . setProjectType ( ProjectType . PROJECT_PHYLINK ) ; projectProps . setPhysicalLinkTypeEnum ( PhysicalLinkTypeEnum . SERIAL_PORT ) ; final Map < String , Object > dataModel = projectProps . getProperties ( ) ; PrintStream out = new PrintStream ( System . out ) ; ArgumentCaptor < Writer > outWriter = ArgumentCaptor . forClass ( Writer . class ) ; m_SUT . initialize ( m_Config , out ) ; m_SUT . create ( projectProps , m_ProjectDir ) ; verifyCreation ( dataModel , outWriter ) ; verify ( m_FileOutputStream ) . write ( ProjectPhysicalLinkCapabilities . getCapabilities ( PhysicalLinkTypeEnum . SERIAL_PORT ) ) ; assertThat ( projectProps . getProperties ( ) , hasEntry ( ProjectProperties . PROP_ATTR_TYPE , ( Object ) "SerialPort" ) ) ; assertThat ( projectProps . getProperties ( ) , hasEntry ( ProjectProperties . PROP_PROXY_TYPE , ( Object ) "SerialPort" ) ) ; String serialPortCode = "@Override\n" + "    public void setDTR(final boolean high) throws UnsupportedOperationException\n" + "    {\n" + "        // ${task}: Method should adjust the data transmit ready pin based on the input. If\n" + "        // operation is supported, remove the throw below. If not supported, keep method as is.\n" + "\n" + "        throw new UnsupportedOperationException(\"Platform does not support setting DTR\");\n" + "    }\n" ; assertThat ( projectProps . getProperties ( ) , hasEntry ( ProjectProperties . PROP_PL_EXTRA_CODE , ( Object ) serialPortCode ) ) ; }
Test that creating a physical link plug-in project will process the correct files.
Test that creating a physical link plug - in project will process the correct files .
// Stubbing // Instantiated objects // Method Call // NOCHECKSTYLE: repeated string literal, not worried about other copy keeping in sync