### Question:
QRCodeUtils { public static String createHotspotInfo(String ssid, int port, String password) throws JSONException { JSONObject hotspotQRCode = new JSONObject(); hotspotQRCode.put(SSID, ssid); hotspotQRCode.put(PORT, port); if (password == null) { hotspotQRCode.put(PROTECTED, false); } else { hotspotQRCode.put(PROTECTED, true); hotspotQRCode.put(PASSWORD, password); } return hotspotQRCode.toString(); } private  QRCodeUtils(); static Observable<Bitmap> generateQRCode(String ssid, int port, String password); static String createHotspotInfo(String ssid, int port, String password); static Bitmap generateQRBitMap(String data, int sideLength); static final String SSID; static final String PORT; static final String PROTECTED; static final String PASSWORD; static final int SIDE_LENGTH; }### Answer:
@Test public void createHotspotInfoTest() throws JSONException { String ssid = "DeviceSSID"; int port = 3; String password = "password"; String hotspotInfo = QRCodeUtils.createHotspotInfo(ssid, port, password); JSONObject hotspotInfoJson = new JSONObject(hotspotInfo); assertTrue(hotspotInfoJson.get(QRCodeUtils.SSID).equals(ssid)); assertTrue(hotspotInfoJson.getInt(QRCodeUtils.PORT) == port); assertTrue(hotspotInfoJson.getBoolean(QRCodeUtils.PROTECTED)); assertTrue(hotspotInfoJson.get(QRCodeUtils.PASSWORD).equals(password)); password = null; hotspotInfo = QRCodeUtils.createHotspotInfo(ssid, port, password); hotspotInfoJson = new JSONObject(hotspotInfo); assertTrue(hotspotInfoJson.get(QRCodeUtils.SSID).equals(ssid)); assertFalse(hotspotInfoJson.getBoolean(QRCodeUtils.PROTECTED)); assertTrue(hotspotInfoJson.getInt(QRCodeUtils.PORT) == port); }