test_class.declarator: LOCALE_PARSER = new LocaleParser()
test_class.modifier: private static final
test_class.original_string: private static final LocaleParser LOCALE_PARSER = new LocaleParser();
test_class.type: LocaleParser
test_class.var_name: LOCALE_PARSER
test_class.file: http/src/test/java/ro/polak/http/protocol/parser/impl/LocaleParserTest.java
test_class.identifier: LocaleParserTest
test_case.body: @Test
      public void shouldHandleProperlyMissingWeight() throws MalformedInputException {
          String localeString = "pl-PL,ru;q=0.2,en;q=0.4,ro;q=0.3,pl";
          List<Locale> locales = LOCALE_PARSER.parse(localeString);
  
          assertThat(locales.get(0), is(new Locale("pl")));
          assertThat(locales.get(1), is(new Locale("en")));
          assertThat(locales.get(2), is(new Locale("ro")));
          assertThat(locales.get(3), is(new Locale("ru")));
      }
test_case.class_method_signature: LocaleParserTest.shouldHandleProperlyMissingWeight()
test_case.full_signature: @Test public void shouldHandleProperlyMissingWeight()
test_case.identifier: shouldHandleProperlyMissingWeight
test_case.invocations: parse assertThat get is assertThat get is assertThat get is assertThat get is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldHandleProperlyMissingWeight()
focal_class.declarator: LOCALE_SEPARATOR = ","
focal_class.modifier: private static final
focal_class.original_string: private static final String LOCALE_SEPARATOR = ",";
focal_class.type: String
focal_class.var_name: LOCALE_SEPARATOR
focal_class.declarator: WEIGHT_SEPARATOR = ";"
focal_class.modifier: private static final
focal_class.original_string: private static final String WEIGHT_SEPARATOR = ";";
focal_class.type: String
focal_class.var_name: WEIGHT_SEPARATOR
focal_class.declarator: WEIGHT_PREFIX = "q="
focal_class.modifier: private static final
focal_class.original_string: private static final String WEIGHT_PREFIX = "q=";
focal_class.type: String
focal_class.var_name: WEIGHT_PREFIX
focal_class.file: http/src/main/java/ro/polak/http/protocol/parser/impl/LocaleParser.java
focal_class.identifier: LocaleParser
focal_class.interfaces: implements Parser<List<Locale>>
focal_class.class_method_signature: LocaleParser.parse(final String input)
focal_class.full_signature: @Override public List<Locale> parse(final String input)
focal_class.identifier: parse
focal_class.modifiers: @Override public
focal_class.parameters: (final String input)
focal_class.return: List<Locale>
focal_class.signature: List<Locale> parse(final String input)
focal_class.class_method_signature: LocaleParser.toLocales(final List<LocaleWithWeight> localesWithWeight)
focal_class.full_signature: private List<Locale> toLocales(final List<LocaleWithWeight> localesWithWeight)
focal_class.identifier: toLocales
focal_class.modifiers: private
focal_class.parameters: (final List<LocaleWithWeight> localesWithWeight)
focal_class.return: List<Locale>
focal_class.signature: List<Locale> toLocales(final List<LocaleWithWeight> localesWithWeight)
focal_method.body: @Override
      public List<Locale> parse(final String input) throws MalformedInputException {
          String[] localesStr = input.split(LOCALE_SEPARATOR);
          List<LocaleWithWeight> localesWithWeight = new ArrayList<>();
  
          for (String locale : localesStr) {
              double weight = 1.0;
              String[] localeParts = locale.split(WEIGHT_SEPARATOR);
  
              if (localeParts.length == 0) {
                  continue;
              }
  
              if (localeParts[0].length() != 2) {
                  continue;
              }
  
              if (localeParts.length > 1 && localeParts[1].length() > 0) {
                  if (localeParts[1].startsWith(WEIGHT_PREFIX)) {
                      weight = Double.parseDouble(localeParts[1].substring(2));
                  } else {
                      continue;
                  }
              }
  
              localesWithWeight.add(new LocaleWithWeight(new Locale(localeParts[0]), weight));
          }
  
          return toLocales(localesWithWeight);
      }
focal_method.class_method_signature: LocaleParser.parse(final String input)
focal_method.full_signature: @Override public List<Locale> parse(final String input)
focal_method.identifier: parse
focal_method.invocations: split split length length startsWith parseDouble substring add toLocales
focal_method.modifiers: @Override public
focal_method.parameters: (final String input)
focal_method.return: List<Locale>
focal_method.signature: List<Locale> parse(final String input)