Search in sources :

Example 1 with NitfAttributeConverters

use of org.codice.alliance.transformer.nitf.NitfAttributeConverters in project alliance by codice.

the class NitfHeaderAttributeTest method testNitfFileReleasabilityWithMultipleSpaces.

@Test
public void testNitfFileReleasabilityWithMultipleSpaces() throws Exception {
    CountryCodeConverter mockCountryCodeConverter = mock(CountryCodeConverter.class);
    doReturn(Collections.singletonList("USA")).when(mockCountryCodeConverter).convertFipsToIso3("US");
    doReturn(Collections.singletonList("GBR")).when(mockCountryCodeConverter).convertFipsToIso3("GB");
    new NitfAttributeConverters(mockCountryCodeConverter);
    FileSecurityMetadata fsmMock = mock(FileSecurityMetadata.class);
    when(nitfHeader.getFileSecurityMetadata()).thenReturn(fsmMock);
    when(nitfHeader.getFileSecurityMetadata().getReleaseInstructions()).thenReturn("US    GB");
    Serializable value = NitfHeaderAttribute.FILE_RELEASING_INSTRUCTIONS_ATTRIBUTE.getAccessorFunction().apply(nitfHeader);
    assertThat(value, is(equalTo("USA GBR")));
}
Also used : Serializable(java.io.Serializable) NitfAttributeConverters(org.codice.alliance.transformer.nitf.NitfAttributeConverters) CountryCodeConverter(org.codice.ddf.internal.country.converter.api.CountryCodeConverter) FileSecurityMetadata(org.codice.imaging.nitf.core.security.FileSecurityMetadata) Test(org.junit.Test)

Aggregations

Serializable (java.io.Serializable)1 NitfAttributeConverters (org.codice.alliance.transformer.nitf.NitfAttributeConverters)1 CountryCodeConverter (org.codice.ddf.internal.country.converter.api.CountryCodeConverter)1 FileSecurityMetadata (org.codice.imaging.nitf.core.security.FileSecurityMetadata)1 Test (org.junit.Test)1