@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)); }
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 { 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 { 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); }
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); }
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);  }