|
| 1 | +package org.w3id.cwl.cwl1_2.utils; |
| 2 | + |
| 3 | +import org.w3id.cwl.cwl1_2.Process; |
| 4 | +import org.w3id.cwl.cwl1_2.SchemaDefRequirement; |
| 5 | +import org.w3id.cwl.cwl1_2.CWLVersion; |
| 6 | +import org.w3id.cwl.cwl1_2.InlineJavascriptRequirement; |
| 7 | +import org.w3id.cwl.cwl1_2.InputRecordSchema; |
| 8 | + |
| 9 | +import java.net.URISyntaxException; |
| 10 | +import java.util.List; |
| 11 | + |
| 12 | +import org.junit.Assert; |
| 13 | +import org.junit.Test; |
| 14 | + |
| 15 | +public class RequirementsClassTest { |
| 16 | + Process doc; |
| 17 | + |
| 18 | + public RequirementsClassTest() throws URISyntaxException { |
| 19 | + super(); |
| 20 | + this.doc = (Process) RootLoader |
| 21 | + .loadDocument(java.nio.file.Paths.get(getClass().getResource("valid_writable-dir-docker.cwl").toURI())); |
| 22 | + } |
| 23 | + |
| 24 | + @Test |
| 25 | + public void className() { |
| 26 | + Assert.assertEquals(doc.getClass().getSimpleName(), "CommandLineToolImpl"); |
| 27 | + } |
| 28 | + |
| 29 | + @Test |
| 30 | + public void version() { |
| 31 | + java.util.Optional<CWLVersion> version = doc.getCwlVersion(); |
| 32 | + Assert.assertTrue(version.isPresent()); |
| 33 | + Assert.assertEquals(CWLVersion.V1_2, version.get()); |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + public void hints() { |
| 38 | + java.util.Optional<java.util.List<Object>> hints = doc.getHints(); |
| 39 | + Assert.assertTrue(hints.isPresent()); |
| 40 | + java.util.List<Object> hintList = hints.get(); |
| 41 | + Assert.assertEquals(hintList.size(), 1); |
| 42 | + } |
| 43 | + |
| 44 | + @Test |
| 45 | + public void reqs() { |
| 46 | + java.util.Optional<java.util.List<Object>> reqs = doc.getRequirements(); |
| 47 | + Assert.assertTrue(reqs.isPresent()); |
| 48 | + java.util.List<Object> reqList = reqs.get(); |
| 49 | + Assert.assertEquals(reqList.size(), 2); |
| 50 | + InlineJavascriptRequirement reqOne = (InlineJavascriptRequirement) reqList.get(0); |
| 51 | + Assert.assertEquals(reqOne.getClass().getSimpleName(), "InlineJavascriptRequirementImpl"); |
| 52 | + Assert.assertNotEquals(reqList.get(1).getClass().getSimpleName(), "InlineJavascriptRequirementImpl"); |
| 53 | + } |
| 54 | + |
| 55 | +} |
0 commit comments