### Question:
Parser { static Integer[] processStoichiometryIndication(String ratioString) throws ParsingException { ratioString = ratioString.trim(); ratioString = ratioString.substring(1, ratioString.length()-1); String[] ratioStrings = ratioString.split(":"); if (ratioStrings.length ==1){ ratioStrings = ratioString.split("/"); } Integer[] componentRatios = new Integer[ratioStrings.length]; for (int i = 0; i < ratioStrings.length; i++) { String currentRatio = ratioStrings[i]; if (currentRatio.contains("/")){ throw new ParsingException("Unexpected / in component ratio declaration"); } if (currentRatio.equals("?")){ componentRatios[i] = 1; } else{ componentRatios[i] = Integer.parseInt(currentRatio); } } return componentRatios; } Parser();   Parser(WordRules wordRules, Tokeniser tokeniser, ResourceManager resourceManager);   }### Answer:
@Test public void testConvertStringToComponentRatios1() throws ParsingException { String ratio = "(1:2)"; Integer[] componentRatios = Parser.processStoichiometryIndication(ratio); assertEquals(2, componentRatios.length); for (int i = 0; i < componentRatios.length; i++) { if (i==0){ assertEquals(1,(int) componentRatios[i]); } if (i==1){ assertEquals(2,(int) componentRatios[i]); } } }
@Test public void testConvertStringToComponentRatios2() throws ParsingException { String ratio = "[1/1/2]"; Integer[] componentRatios = Parser.processStoichiometryIndication(ratio); assertEquals(3, componentRatios.length); for (int i = 0; i < componentRatios.length; i++) { if (i==0){ assertEquals(1,(int) componentRatios[i]); } if (i==1){ assertEquals(1,(int) componentRatios[i]); } if (i==2){ assertEquals(2,(int) componentRatios[i]); } } }
@Test public void testConvertStringToComponentRatios3() throws ParsingException { String ratio = "(1:2:?)"; Integer[] componentRatios = Parser.processStoichiometryIndication(ratio); assertEquals(3, componentRatios.length); for (int i = 0; i < componentRatios.length; i++) { if (i==0){ assertEquals(1,(int) componentRatios[i]); } if (i==1){ assertEquals(2,(int) componentRatios[i]); } if (i==2){ assertEquals(1,(int) componentRatios[i]); } } }