chg xslt, add test class
This commit is contained in:
parent
103024d23e
commit
2baa038d0e
|
@ -1,26 +1,19 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.transformation.xslt;
|
package eu.dnetlib.dhp.transformation.xslt;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import java.util.List;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
import org.hamcrest.CoreMatchers;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.junit.Test;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.ArgumentCaptor;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class PersonCleanerTest {
|
public class PersonCleanerTest {
|
||||||
|
|
||||||
private PersonCleaner personCleaner;
|
private PersonCleaner personCleaner;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
this.personCleaner = new PersonCleaner();
|
this.personCleaner = new PersonCleaner();
|
||||||
}
|
}
|
||||||
|
@ -80,35 +73,4 @@ public class PersonCleanerTest {
|
||||||
|
|
||||||
// TODO: assert scenario
|
// TODO: assert scenario
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldGetName() {
|
|
||||||
QName actualValue = personCleaner.getName();
|
|
||||||
|
|
||||||
// TODO: assert scenario
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldGetResultType() {
|
|
||||||
SequenceType actualValue = personCleaner.getResultType();
|
|
||||||
|
|
||||||
// TODO: assert scenario
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldGetArgumentTypes() {
|
|
||||||
SequenceType[] actualValue = personCleaner.getArgumentTypes();
|
|
||||||
|
|
||||||
// TODO: assert scenario
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldCall() {
|
|
||||||
// TODO: initialize args
|
|
||||||
XdmValue[] xdmValues;
|
|
||||||
|
|
||||||
XdmValue actualValue = personCleaner.call(xdmValues);
|
|
||||||
|
|
||||||
// TODO: assert scenario
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
exclude-result-prefixes="xsl vocabulary dateCleaner">
|
exclude-result-prefixes="xsl vocabulary dateCleaner">
|
||||||
|
|
||||||
<xsl:param name="varOfficialName" />
|
<xsl:param name="varOfficialName" />
|
||||||
<xsl:param name="varDsType" />
|
<!-- deprecated , marked to remove <xsl:param name="varDsType" /> -->
|
||||||
<xsl:param name="varDataSourceId" />
|
<xsl:param name="varDataSourceId" />
|
||||||
|
|
||||||
<xsl:param name="varFP7" select = "'corda_______::'"/>
|
<xsl:param name="varFP7" select = "'corda_______::'"/>
|
||||||
|
@ -68,6 +68,12 @@
|
||||||
<xsl:call-template name="validRecord" />
|
<xsl:call-template name="validRecord" />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="terminate">
|
||||||
|
<xsl:message terminate="yes">
|
||||||
|
record is not compliant, transformation is interrupted.
|
||||||
|
</xsl:message>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="validRecord">
|
<xsl:template name="validRecord">
|
||||||
<record>
|
<record>
|
||||||
<xsl:apply-templates select="//*[local-name() = 'header']" />
|
<xsl:apply-templates select="//*[local-name() = 'header']" />
|
||||||
|
@ -276,6 +282,9 @@
|
||||||
<xsl:value-of select="$varEmbargoEndDate"/>
|
<xsl:value-of select="$varEmbargoEndDate"/>
|
||||||
</oaf:embargoenddate>
|
</oaf:embargoenddate>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="terminate"/>
|
||||||
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
@ -301,6 +310,9 @@
|
||||||
</dr:CobjCategory>
|
</dr:CobjCategory>
|
||||||
-->
|
-->
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="terminate"/>
|
||||||
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
<!-- review status -->
|
<!-- review status -->
|
||||||
|
|
Loading…
Reference in New Issue