| 1 |
package io.github.dan2097.jnarinchi; |
| 2 |
|
| 3 |
import org.junit.jupiter.api.Assertions; |
| 4 |
import org.junit.jupiter.api.Test; |
| 5 |
|
| 6 |
class RinchiDecompositionOutputTest { |
| 7 |
|
| 8 |
// inchis, auxInfo, roles are null; not expected to raise an exception |
| 9 |
@Test |
| 10 |
void testRinchiDecompositionOutput_constructor_ThreeArraysNull() { |
| 11 |
Assertions.assertDoesNotThrow( |
| 12 |
() -> new RinchiDecompositionOutput( |
| 13 |
ReactionDirection.FORWARD, |
| 14 |
null, |
| 15 |
null, |
| 16 |
null, |
| 17 |
Status.SUCCESS, |
| 18 |
0, |
| 19 |
""), |
| 20 |
"Testing constructor, the arrays inchis, auxInfo, roles are all null; not expected to raise an exception."); |
| 21 |
} |
| 22 |
|
| 23 |
// inchis, auxInfo, roles have three elements each; not expected to raise an exception |
| 24 |
@Test |
| 25 |
void testRinchiDecompositionOutput_constructor_ThreeArraysThreeElements() { |
| 26 |
Assertions.assertDoesNotThrow( |
| 27 |
() -> new RinchiDecompositionOutput( |
| 28 |
ReactionDirection.FORWARD, |
| 29 |
new String[]{"inchi1", "inchi2", "inchi3"}, |
| 30 |
new String[]{"auxInfo1", "auxInfo2", "auxInfo3"}, |
| 31 |
new ReactionComponentRole[]{ReactionComponentRole.REAGENT, ReactionComponentRole.REAGENT, ReactionComponentRole.PRODUCT}, |
| 32 |
Status.SUCCESS, |
| 33 |
0, |
| 34 |
""), |
| 35 |
"Testing constructor, the arrays inchis, auxInfo, roles have three elements each; not expected to raise an exception."); |
| 36 |
} |
| 37 |
|
| 38 |
// inchis, auxInfo with three elements each, roles is null; expected to raise an exception |
| 39 |
@Test |
| 40 |
void testRinchiDecompositionOutput_constructor_TwoArraysThreeElements_OneArrayNull() { |
| 41 |
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> new RinchiDecompositionOutput( |
| 42 |
ReactionDirection.FORWARD, |
| 43 |
new String[]{"inchi1", "inchi2", "inchi3"}, |
| 44 |
new String[]{"auxInfo1", "auxInfo2", "auxInfo3"}, |
| 45 |
null, |
| 46 |
Status.SUCCESS, |
| 47 |
0, |
| 48 |
""), |
| 49 |
"Testing constructor, the arrays inchis, auxInfo have three elements each, roles is null; expected to raise an exception."); |
| 50 |
} |
| 51 |
|
| 52 |
// inchis, auxInfo with three elements each, roles with two elements; expected to raise an exception |
| 53 |
@Test |
| 54 |
void testRinchiDecompositionOutput_constructor_TwoArraysThreeElements_OneArrayTwoElements() { |
| 55 |
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> new RinchiDecompositionOutput( |
| 56 |
ReactionDirection.FORWARD, |
| 57 |
new String[]{"inchi1", "inchi2", "inchi3"}, |
| 58 |
new String[]{"auxInfo1", "auxInfo2", "auxInfo3"}, |
| 59 |
new ReactionComponentRole[]{ReactionComponentRole.REAGENT, ReactionComponentRole.PRODUCT}, |
| 60 |
Status.SUCCESS, |
| 61 |
0, |
| 62 |
""), |
| 63 |
"Testing constructor, the arrays inchis, auxInfo have three elements each, roles has two elements; expected to raise an exception."); |
| 64 |
} |
| 65 |
} |