### Question:
Permission implements BiSerializable, Comparable<Permission> { public void setId(@NonNull String id) { if( this.id != null && !this.id.equals(id) ) throw new IllegalStateException("permission id is already set"); this.id = id; } protected  Permission(); protected  Permission(String name, Role role); protected  Permission(String name, Role role, Binder params); @Nullable String getId(); void setId(@NonNull String id); Binder getParams(); static Permission forName(String name, Role role, Binder params); @Deprecated boolean isAllowedForKeys(PublicKey... keys); @Deprecated boolean isAllowedForKeys(Collection<PublicKey> keys); @Deprecated boolean isAllowedFor(Collection<PublicKey> keys); boolean isAllowedForKeysQuantized(PublicKey... keys); boolean isAllowedForKeysQuantized(Collection<PublicKey> keys); boolean isAllowedForQuantized(Collection<PublicKey> keys); @Override Binder serialize(BiSerializer serializer); @Override void deserialize(Binder data, BiDeserializer deserializer); final void checkChanges(Contract contract, Contract changed, Map<String, Delta> stateChanges, Set<Contract> revokingItems, Collection<PublicKey> keys); abstract void checkChangesQuantized(Contract contract, Contract changed, Map<String, Delta> stateChanges, Set<Contract> revokingItems, Collection<PublicKey> keys); @Override String toString(); Role getRole(); String getName(); @Override boolean equals(Object obj); @Override int compareTo(Permission o);  }### Answer:
@Test public void contractGetPermission() throws Exception { Contract contract = new Contract(TestKeys.privateKey(0)); Contract contract2 = new Contract(TestKeys.privateKey(0)); ChangeNumberPermission changeNumberPermission = new ChangeNumberPermission(new RoleLink("@owner", "owner"), Binder.of( "field_name", "field1", "min_value", 33, "max_value", 34, "min_step", 1, "max_step", 1 ) ); changeNumberPermission.setId("changenumber"); contract.addPermission(changeNumberPermission); contract2.addPermission(changeNumberPermission); contract.seal(); contract2.seal(); contract = Contract.fromPackedTransaction(contract.getPackedTransaction()); contract2 = Contract.fromPackedTransaction(contract2.getPackedTransaction()); assertNotNull(contract.get("definition.permissions.changenumber")); assertEquals((Permission)contract.get("definition.permissions.changenumber"),contract2.get("definition.permissions.changenumber")); }