### Question:
LockTypeUtil { public static Optional<LockType> getLockTypeFromEncoding(char encoding) { return Optional.ofNullable(PERSISTENCE_ENCODINGS.inverse().get(encoding)); }  static char getEncoding(LockType lockType); static String getEncodingAsStr(LockType lockType); static Optional<LockType> getLockTypeFromEncoding(char encoding); static String exclusive(); static String exclWrite(); static String sharedWrite(); static String sharedRead();  }### Answer:
@Test public void testGetLockType() { assertEquals(LockType.SHARED_READ, LockTypeUtil.getLockTypeFromEncoding('r').get()); assertEquals(LockType.SHARED_WRITE, LockTypeUtil.getLockTypeFromEncoding('w').get()); assertEquals(LockType.EXCL_WRITE, LockTypeUtil.getLockTypeFromEncoding('x').get()); assertEquals(LockType.EXCLUSIVE, LockTypeUtil.getLockTypeFromEncoding('e').get()); assertFalse(LockTypeUtil.getLockTypeFromEncoding('y').isPresent()); }