@Test public void testJSONCreationWithoutAttributes() { event = FactoryGirl.createEvent(); json = event.toJSON(); assertTrue(json.has("name")); assertTrue(json.has("date")); }
public JSONObject toJSON() { JSONObject json = new JSONObject(); try { if(mAttributes != null) { for(String key : mAttributes.keySet()){ if(mAttributes.get(key) instanceof Date) { json.put(key, LiquidTools.dateToString((Date) mAttributes.get(key))); } else { json.put(key, mAttributes.get(key)); } } } json.put("name", mName); json.put("date",LiquidTools.dateToString(mDate)); return json; } catch (JSONException e) { LQLog.error("LQEvent toJSON: " + e.getMessage()); } return null; }
LQEvent extends LQModel { public JSONObject toJSON() { JSONObject json = new JSONObject(); try { if(mAttributes != null) { for(String key : mAttributes.keySet()){ if(mAttributes.get(key) instanceof Date) { json.put(key, LiquidTools.dateToString((Date) mAttributes.get(key))); } else { json.put(key, mAttributes.get(key)); } } } json.put("name", mName); json.put("date",LiquidTools.dateToString(mDate)); return json; } catch (JSONException e) { LQLog.error("LQEvent toJSON: " + e.getMessage()); } return null; } }
LQEvent extends LQModel { public JSONObject toJSON() { JSONObject json = new JSONObject(); try { if(mAttributes != null) { for(String key : mAttributes.keySet()){ if(mAttributes.get(key) instanceof Date) { json.put(key, LiquidTools.dateToString((Date) mAttributes.get(key))); } else { json.put(key, mAttributes.get(key)); } } } json.put("name", mName); json.put("date",LiquidTools.dateToString(mDate)); return json; } catch (JSONException e) { LQLog.error("LQEvent toJSON: " + e.getMessage()); } return null; } LQEvent(String name, HashMap<String,Object> attributes, Date date);  LQEvent(String name, HashMap<String,Object> attributes); }
LQEvent extends LQModel { public JSONObject toJSON() { JSONObject json = new JSONObject(); try { if(mAttributes != null) { for(String key : mAttributes.keySet()){ if(mAttributes.get(key) instanceof Date) { json.put(key, LiquidTools.dateToString((Date) mAttributes.get(key))); } else { json.put(key, mAttributes.get(key)); } } } json.put("name", mName); json.put("date",LiquidTools.dateToString(mDate)); return json; } catch (JSONException e) { LQLog.error("LQEvent toJSON: " + e.getMessage()); } return null; } LQEvent(String name, HashMap<String,Object> attributes, Date date);  LQEvent(String name, HashMap<String,Object> attributes); void setName(String name); String getName(); JSONObject toJSON(); static boolean hasValidName(String name, boolean raiseException); }
LQEvent extends LQModel { public JSONObject toJSON() { JSONObject json = new JSONObject(); try { if(mAttributes != null) { for(String key : mAttributes.keySet()){ if(mAttributes.get(key) instanceof Date) { json.put(key, LiquidTools.dateToString((Date) mAttributes.get(key))); } else { json.put(key, mAttributes.get(key)); } } } json.put("name", mName); json.put("date",LiquidTools.dateToString(mDate)); return json; } catch (JSONException e) { LQLog.error("LQEvent toJSON: " + e.getMessage()); } return null; } LQEvent(String name, HashMap<String,Object> attributes, Date date);  LQEvent(String name, HashMap<String,Object> attributes); void setName(String name); String getName(); JSONObject toJSON(); static boolean hasValidName(String name, boolean raiseException); static final String UNNAMED_EVENT; }