### Question:
BlockState { public static BlockState fromString(String serializedBlockState) throws IllegalArgumentException { try { Matcher m = BLOCKSTATE_SERIALIZATION_PATTERN.matcher(serializedBlockState); m.find(); Map<String, String> pt = new HashMap<>(); String g2 = m.group(2); if (g2 != null && !g2.isEmpty()){ String[] propertyStrings = g2.trim().split(","); for (String s : propertyStrings){ String[] kv = s.split("=", 2); pt.put(kv[0], kv[1]); } } String blockId = m.group(1).trim(); return new BlockState(blockId, pt); } catch (RuntimeException ex) { throw new IllegalArgumentException("'" + serializedBlockState + "' could not be parsed to a BlockState!"); } } BlockState(String id);  BlockState(String id, Map<String, String> properties); private  BlockState(BlockState blockState, String withKey, String withValue); String getNamespace(); String getId(); String getFullId(); Map<String, String> getProperties(); BlockState with(String property, String value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static BlockState fromString(String serializedBlockState); static final BlockState AIR; static final BlockState MISSING; }### Answer:
@Test public void testFromString() { BlockState blockState = BlockState.fromString("somemod:someblock"); assertEquals("somemod:someblock", blockState.getFullId()); assertEquals("somemod", blockState.getNamespace()); assertEquals("someblock", blockState.getId()); assertTrue(blockState.getProperties().isEmpty()); blockState = BlockState.fromString("somemod:someblock[]"); assertEquals("somemod:someblock", blockState.getFullId()); assertEquals("somemod", blockState.getNamespace()); assertEquals("someblock", blockState.getId()); assertTrue(blockState.getProperties().isEmpty()); blockState = BlockState.fromString("somemod:someblock[testProp=testVal,testProp2=testVal2]"); assertEquals("somemod:someblock", blockState.getFullId()); assertEquals("somemod", blockState.getNamespace()); assertEquals("someblock", blockState.getId()); assertEquals("testVal", blockState.getProperties().get("testProp")); assertEquals("testVal2", blockState.getProperties().get("testProp2")); }