示例#1
0
 protected ResourceState resource(
     String id, String parentUri, Object[] properties, List<ResourceState> members)
     throws URISyntaxException {
   DefaultResourceState state = new DefaultResourceState(id);
   state.uri(new URI(parentUri + "/" + id));
   assertThat(properties.length % 2).isEqualTo(0);
   int count = properties.length / 2;
   for (int i = 0; i < count; i++) {
     String key = (String) properties[2 * i];
     Object val = properties[2 * i + 1];
     state.putProperty(key, val);
   }
   for (ResourceState resource : members) {
     state.members().add(resource);
   }
   return state;
 }