### Question:
Instance extends com.alibaba.nacos.api.naming.pojo.Instance implements Comparable { public static Instance fromJSON(String json) { Instance ip; try { ip = JSON.parseObject(json, Instance.class); } catch (Exception e) { ip = fromString(json); } if (ip == null) { throw new IllegalArgumentException("malformed ip config: " + json); } if (ip.getWeight() > MAX_WEIGHT_VALUE) { ip.setWeight(MAX_WEIGHT_VALUE); } if (ip.getWeight() < MIN_POSITIVE_WEIGHT_VALUE && ip.getWeight() > MIN_WEIGHT_VALUE) { ip.setWeight(MIN_POSITIVE_WEIGHT_VALUE); } else if (ip.getWeight() < MIN_WEIGHT_VALUE) { ip.setWeight(0.0D); } try { ip.validate(); } catch (NacosException e) { throw new IllegalArgumentException("malformed ip config: " + json); } return ip; } Instance();  Instance(String ip, int port);  Instance(String ip, int port, String clusterName);  Instance(String ip, int port, String clusterName, String tenant, String app); boolean isMockValid(); void setMockValid(boolean mockValid); long getLastBeat(); void setLastBeat(long lastBeat); static Instance fromString(String config); String toIPAddr(); @Override String toString(); String toJSON(); static Instance fromJSON(String json); @Override boolean equals(Object obj); @JSONField(serialize = false) String getDatumKey(); @JSONField(serialize = false) String getDefaultKey(); @Override int hashCode(); void setBeingChecked(boolean isBeingChecked); boolean markChecking(); @JSONField(serialize = false) long getCheckRT(); @JSONField(serialize = false) AtomicInteger getOKCount(); @JSONField(serialize = false) AtomicInteger getFailCount(); @JSONField(serialize = false) void setCheckRT(long checkRT); boolean isMarked(); void setMarked(boolean marked); String getApp(); void setApp(String app); String getTenant(); void setTenant(String tenant); String generateInstanceId(); String generateInstanceId(Set<String> currentInstanceIds); void validate(); @Override int compareTo(Object o);  }### Answer:
@Test public void fromJson() { instance = Instance.fromJSON("2.2.2.2:8888_2_TEST1"); Assert.assertEquals("2.2.2.2", instance.getIp()); Assert.assertEquals(8888, instance.getPort()); Assert.assertEquals(2, instance.getWeight(), 0.001); Assert.assertEquals("TEST1", instance.getClusterName()); }