### Question:
ArgumentResolver { void resolveOffsets(Map<String, Object> offsetMap, Calendar calendar){ zip(Constants.KEYS_TIME, Constants.KEYS_CAL_FIELD) .forEach((key, field) -> { if(offsetMap.containsKey(key)){ int quantity = ((Number) offsetMap.get(key)).intValue(); if(key.equals(Constants.KEY_WEEK)) quantity *= 7; calendar.add(field, quantity); } return true; }); } ArgumentResolver(Context context); Reminder resolve(Map<String, Object> map, String rawText, Calendar now);  }### Answer:
@Test public void resolveOffsets(){ Calendar c = Calendar.getInstance(); c.clear(); c.set(2018, 4, 22); Map<String, Object> map = make("{year:2}"); resolver.resolveOffsets(map, c); assertEquals(2020, c.get(Calendar.YEAR)); assertEquals(4, c.get(Calendar.MONTH)); assertEquals(22, c.get(Calendar.DAY_OF_MONTH)); }
@Test public void resolveOffsetsPm(){ Calendar c = Calendar.getInstance(); c.clear(); c.set(2018, 4, 22, 12, 20, 30); Map<String, Object> map = make("{minute:10}"); resolver.resolveOffsets(map, c); assertEquals(2018, c.get(Calendar.YEAR)); assertEquals(4, c.get(Calendar.MONTH)); assertEquals(22, c.get(Calendar.DAY_OF_MONTH)); assertEquals(0, c.get(Calendar.HOUR)); assertEquals(30, c.get(Calendar.MINUTE)); assertEquals(Calendar.PM, c.get(Calendar.AM_PM)); }
@Test public void resolveOffsetsWeek(){ Calendar c = Calendar.getInstance(); c.clear(); c.set(2018, 5, 29); Map<String, Object> map = make("{week:2}"); resolver.resolveOffsets(map, c); assertEquals(2018, c.get(Calendar.YEAR)); assertEquals(6, c.get(Calendar.MONTH)); assertEquals(13, c.get(Calendar.DAY_OF_MONTH)); }