### Question:
Converter { public ConvertedParameters convert(final RawParameters raw) { return new ConvertedParameters( convertContext(raw.getContext()), convertIdentifiers(raw.getIdentifiers()), raw.getTest(), convertForceGroups(raw.getForceGroups()) ); } Converter(final List<ContextVariable> contextList); ConvertedParameters convert(final RawParameters raw);  }### Answer:
@Test public void testConvertContextVariables() { final Converter converter = getBasicConverter(); final Map<String, String> rawVariables = ImmutableMap.of( "loggedin", "1", "char", "B" ); final RawParameters rawParameters = new RawParameters( rawVariables, Collections.<TestType, String>emptyMap(), Collections.<String>emptyList(), "" ); final ConvertedParameters convertedParameters = converter.convert(rawParameters); assertEquals(Boolean.TRUE, convertedParameters.getContext().get("loggedin")); assertEquals('B', convertedParameters.getContext().get("char")); assertEquals(0, convertedParameters.getTest().size()); assertEquals(0, convertedParameters.getForceGroups().size()); }
@Test(expected = BadRequestException.class) public void testConvertContextVariables_ConversionError() { final Converter converter = getBasicConverter(); final Map<String, String> rawVariables = ImmutableMap.of( "loggedin", "1", "char", "ABC" ); final RawParameters rawParameters = new RawParameters( rawVariables, Collections.<TestType, String>emptyMap(), Collections.<String>emptyList(), "" ); final ConvertedParameters convertedParameters = converter.convert(rawParameters); }
@Test(expected = InternalServerException.class) public void testConvertContextVariables_MissingVariable() { final Converter converter = getBasicConverter(); final Map<String, String> rawVariables = ImmutableMap.of( "wrong-variable", "ABC" ); final RawParameters rawParameters = new RawParameters( rawVariables, Collections.<TestType, String>emptyMap(), Collections.<String>emptyList(), "" ); final ConvertedParameters convertedParameters = converter.convert(rawParameters); }