### Question:
SlotKeySerDes { protected static Granularity granularityFromSlotKey(String s) { String field = s.split(",", -1)[0]; for (Granularity g : Granularity.granularities()) if (g.name().startsWith(field)) return g; return null; }  static SlotKey deserialize(String stateStr); String serialize(SlotKey slotKey); String serialize(Granularity gran, int slot, int shard);  }### Answer:
@Test public void testGranularityFromSlotKey() { Granularity expected = Granularity.MIN_5; Granularity myGranularity = SlotKeySerDes.granularityFromSlotKey(SlotKey.of(expected, 1, 1).toString()); Assert.assertNotNull(myGranularity); Assert.assertEquals(myGranularity, expected); myGranularity = SlotKeySerDes.granularityFromSlotKey("FULL"); Assert.assertNull(myGranularity); }