clean up XBRLBuilderTest (re. FINERACT-940)
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
69a7b1e8da
commit
ea85f9c739
+4
-18
@@ -51,43 +51,29 @@ public class XBRLBuilderTest {
|
|||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private NamespaceReadPlatformServiceImpl readNamespaceService;
|
private NamespaceReadPlatformServiceImpl readNamespaceService;
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private final XBRLBuilder xbrlBuilder = new XBRLBuilder();
|
private final XBRLBuilder xbrlBuilder = new XBRLBuilder();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|
||||||
this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class);
|
this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class);
|
||||||
lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString())).thenReturn(
|
lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString())).thenReturn(
|
||||||
new NamespaceData(1l, "mockedprefix", "mockedurl"));
|
new NamespaceData(1l, "mockedprefix", "mockedurl"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldCorrectlyBuildMap() {
|
public void shouldCorrectlyBuildMap() throws SAXException, IOException, ParserConfigurationException {
|
||||||
|
|
||||||
final HashMap<MixTaxonomyData, BigDecimal> map = new HashMap<MixTaxonomyData, BigDecimal>();
|
final HashMap<MixTaxonomyData, BigDecimal> map = new HashMap<MixTaxonomyData, BigDecimal>();
|
||||||
final MixTaxonomyData data1 = Mockito.mock(MixTaxonomyData.class);
|
final MixTaxonomyData data1 = Mockito.mock(MixTaxonomyData.class);
|
||||||
when(data1.getName()).thenReturn("Assets");
|
when(data1.getName()).thenReturn("Assets");
|
||||||
map.put(data1, new BigDecimal(10000));
|
map.put(data1, new BigDecimal(10000));
|
||||||
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"), "USD");
|
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"), "USD");
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
NodeList nodes = null;
|
NodeList nodes = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
|
||||||
try {
|
new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))).getElementsByTagName("Assets");
|
||||||
nodes =
|
|
||||||
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)))
|
|
||||||
.getElementsByTagName("Assets");
|
|
||||||
} catch (final SAXException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (final IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (final ParserConfigurationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
assertNotNull(nodes);
|
assertNotNull(nodes);
|
||||||
assertNotNull(nodes.item(0));
|
assertNotNull(nodes.item(0));
|
||||||
assertEquals("Assets", nodes.item(0).getNodeName());
|
assertEquals("Assets", nodes.item(0).getNodeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user