LinkFormatHelper { public static Link[] getBootstrapClientDescription(Collection<LwM2mObjectEnabler> objectEnablers) { List<Link> links = new ArrayList<>(); Map<String, String> rootAttributes = new HashMap<>(); rootAttributes.put("lwm2m", ObjectModel.DEFAULT_VERSION); links.add(new Link("/", rootAttributes)); for (LwM2mObjectEnabler objectEnabler : objectEnablers) { links.addAll(getBootstrapObjectDescriptionWithoutRoot(objectEnabler)); } return links.toArray(new Link[] {}); } private  LinkFormatHelper(); static Link[] getClientDescription(Collection<LwM2mObjectEnabler> objectEnablers, String rootPath); static Link[] getBootstrapClientDescription(Collection<LwM2mObjectEnabler> objectEnablers); static Link[] getObjectDescription(LwM2mObjectEnabler objectEnabler, String root); static Link[] getBootstrapObjectDescription(LwM2mObjectEnabler objectEnabler); static Link[] getInstanceDescription(LwM2mObjectEnabler objectEnabler, int instanceId, String root); static Link getResourceDescription(LwM2mObjectEnabler objectEnabler, int instanceId, int resourceId,
            String root);  }
@Test public void encode_bootstrap_root() { List<LwM2mObjectEnabler> objectEnablers = new ArrayList<>(); Map<Integer, LwM2mInstanceEnabler> securityInstances = new HashMap<>(); securityInstances.put(0, Security.noSec("coap: securityInstances.put(1, Security.noSecBootstap("coap: securityInstances.put(2, Security.noSec("coap: securityInstances.put(3, Security.noSec("coap: ObjectEnabler securityObjectEnabler = new ObjectEnabler(0, getObjectModel(0), securityInstances, null, ContentFormat.DEFAULT); objectEnablers.add(securityObjectEnabler); Map<Integer, LwM2mInstanceEnabler> serverInstances = new HashMap<>(); serverInstances.put(0, new Server(333, 120, BindingMode.UQ, false)); ObjectEnabler serverObjectEnabler = new ObjectEnabler(1, getVersionedObjectModel(1, "2.0"), serverInstances, null, ContentFormat.DEFAULT); objectEnablers.add(serverObjectEnabler); ObjectEnabler aclObjectEnabler = new ObjectEnabler(2, getVersionedObjectModel(2, "2.0"), new HashMap<Integer, LwM2mInstanceEnabler>(), null, ContentFormat.DEFAULT); objectEnablers.add(aclObjectEnabler); Map<Integer, LwM2mInstanceEnabler> deviceInstances = new HashMap<>(); deviceInstances.put(0, new BaseInstanceEnabler()); ObjectEnabler deviceObjectEnabler = new ObjectEnabler(3, getObjectModel(3), deviceInstances, null, ContentFormat.DEFAULT); objectEnablers.add(deviceObjectEnabler); Link[] links = LinkFormatHelper.getBootstrapClientDescription(objectEnablers); String strLinks = Link.serialize(links); assertEquals( "</>;lwm2m=1.0,</0/0>;ssid=111,</0/1>,</0/2>;ssid=222,</0/3>;ssid=333,</1>;ver=2.0,</1/0>;ssid=333,</2>;ver=2.0,</3/0>", strLinks); }