@Test public void testResolveDirectiveConflicts() { specificPattern = new PatternCacheControl("***", "no-cache, max-age=500, s-maxage=750"); ConflictResolverUtils.resolveConflicts(specificPattern, generalPattern); directives = new HashMap<>(); directives.put(Directive.NO_CACHE, EMPTY_STRING_VALUE); directives.put(Directive.PUBLIC, EMPTY_STRING_VALUE); directives.put(Directive.MAX_AGE, "500"); directives.put(Directive.MAX_AGE_MPLUS, "600"); directives.put(Directive.S_MAX_AGE, "450"); assertEquals(specificPattern.getDirectives(), directives); }
public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) { for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) { Directive generalDirective = entry.getKey(); String generalValue = entry.getValue(); if (generalValue == EMPTY_STRING_VALUE) { specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE); } else { resolveValueConflicts(generalDirective, generalValue, specificPattern); } } }
ConflictResolverUtils { public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) { for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) { Directive generalDirective = entry.getKey(); String generalValue = entry.getValue(); if (generalValue == EMPTY_STRING_VALUE) { specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE); } else { resolveValueConflicts(generalDirective, generalValue, specificPattern); } } } }
ConflictResolverUtils { public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) { for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) { Directive generalDirective = entry.getKey(); String generalValue = entry.getValue(); if (generalValue == EMPTY_STRING_VALUE) { specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE); } else { resolveValueConflicts(generalDirective, generalValue, specificPattern); } } } private  ConflictResolverUtils(); }
ConflictResolverUtils { public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) { for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) { Directive generalDirective = entry.getKey(); String generalValue = entry.getValue(); if (generalValue == EMPTY_STRING_VALUE) { specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE); } else { resolveValueConflicts(generalDirective, generalValue, specificPattern); } } } private  ConflictResolverUtils(); static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern); }
ConflictResolverUtils { public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) { for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) { Directive generalDirective = entry.getKey(); String generalValue = entry.getValue(); if (generalValue == EMPTY_STRING_VALUE) { specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE); } else { resolveValueConflicts(generalDirective, generalValue, specificPattern); } } } private  ConflictResolverUtils(); static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern);  }