Skip to content

Commit 8275f1a

Browse files
author
Flurb
committed
unit tests
Signed-off-by: Flurb <[email protected]>
1 parent 7e63b88 commit 8275f1a

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

validator/src/test/java/org/lfenergy/compas/scl/validator/util/StaxUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import static org.lfenergy.compas.scl.validator.util.StaxUtil.getAttributeValue;
1616
import static org.lfenergy.compas.scl.validator.util.StaxUtil.isElement;
1717

18-
public class StaxUtilTest {
18+
class StaxUtilTest {
1919
@Test
2020
void constructor_WhenConstructorCalled_ThenShouldThrowExceptionCauseForbidden() {
2121
assertThrows(UnsupportedOperationException.class, StaxUtil::new);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
package org.lfenergy.compas.scl.validator.xsd.resourceresolver;
5+
6+
import org.junit.jupiter.api.Test;
7+
8+
import java.io.IOException;
9+
import java.nio.charset.StandardCharsets;
10+
11+
import static org.junit.jupiter.api.Assertions.*;
12+
13+
class ResourceInputTest {
14+
@Test
15+
void allGetters_WhenCalled_ThenCorrectValueIsReturned() throws IOException {
16+
var firstInputStream = this.getClass().getResourceAsStream("/scl/example.scd");
17+
var secondInputStream = this.getClass().getResourceAsStream("/scl/example.scd");
18+
19+
var input = new ResourceInput("1", "2", firstInputStream);
20+
21+
assertEquals("1", input.getPublicId());
22+
assertEquals("2", input.getSystemId());
23+
assertNull(input.getBaseURI());
24+
assertNull(input.getByteStream());
25+
assertFalse(input.getCertifiedText());
26+
assertNull(input.getCharacterStream());
27+
assertNull(input.getEncoding());
28+
29+
var expectedStringData = new String(secondInputStream.readAllBytes(), StandardCharsets.UTF_8);
30+
assertEquals(expectedStringData.hashCode(), input.getStringData().hashCode());
31+
}
32+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
package org.lfenergy.compas.scl.validator.xsd.resourceresolver;
5+
6+
class ResourceResolverTest {
7+
}

0 commit comments

Comments
 (0)