JEEActivityServer implements ActivityServer { protected void processActivityUnit(ActivityUnit au) { if (au.getId() == null) { au.setId(createUniqueId()); } au.init(); }  @ServiceInit void init(); void setActivityStore(ActivityStore store); ActivityStore getActivityStore(); java.util.List<ActivityNotifier> getActivityNotifiers(); void setActivityNotifiers(java.util.List<ActivityNotifier> notifiers); void setUserTransaction(UserTransaction tx); UserTransaction getUserTransaction(); void store(java.util.List<ActivityUnit> activities); ActivityUnit getActivityUnit(String id); java.util.List<ActivityType> query(QuerySpec query); List<ActivityType> getActivityTypes(Context context); List<ActivityType> getActivityTypes(Context context, long from, long to);  }
@Test public void testProcessActivityIdAssignedIfMissing() { JEEActivityServer as=new JEEActivityServer(); ActivityUnit au=new ActivityUnit(); if (au.getId() != null) { fail("ActivityUnit id should be null"); } as.processActivityUnit(au); if (au.getId() == null) { fail("ActivityUnit id should NOT be null"); } }
@Test public void testProcessActivityIdPreservedIfExists() { JEEActivityServer as=new JEEActivityServer(); ActivityUnit au=new ActivityUnit(); au.setId(TEST_ID); as.processActivityUnit(au); if (!au.getId().equals(TEST_ID)) { fail("ActivityUnit id has changed: "+au.getId()); } }