@Test public void testConstructor() throws Exception { try { new AuditLogEntry(null, null, null); Assert.fail("AuditLogEntry must not allow null time"); } catch (IllegalArgumentException ignored) { } try { new AuditLogEntry(Calendar.getInstance(), null, null); Assert.fail("AuditLogEntry must not allow null user"); } catch (IllegalArgumentException ignored) { } UserInfo user = Mockito.mock(UserInfo.class); try { new AuditLogEntry(Calendar.getInstance(), user, null); Assert.fail("AuditLogEntry must not allow null username"); } catch (IllegalArgumentException ignored) { } Mockito.doReturn(Mockito.mock(UserInfo.Username.class)).when(user).getUsername(); Mockito.doReturn("firstname").when(user).getFirstName(); Mockito.doReturn("lastname").when(user).getLastName(); Mockito.doReturn("admin@example.com").when(user).getEmail(); try { new AuditLogEntry(Calendar.getInstance(), user, null); Assert.fail("AuditLogEntry must not allow null action"); } catch (IllegalArgumentException ignored) { } new AuditLogEntry(Calendar.getInstance(), user, AuditLogAction.UNSPECIFIED_ACTION); Experiment experiment = Mockito.mock(Experiment.class); Mockito.doReturn(Mockito.mock(Experiment.Label.class)).when(experiment).getLabel(); Mockito.doReturn(Mockito.mock(Experiment.ID.class)).when(experiment).getID(); Mockito.doReturn(Mockito.mock(Application.Name.class)).when(experiment).getApplicationName(); AuditLogEntry ale = new AuditLogEntry(Calendar.getInstance(), user, AuditLogAction.UNSPECIFIED_ACTION, experiment, Mockito.mock(Bucket.Label.class), "Property", "before", "after"); for (Field f : AuditLogEntry.class.getDeclaredFields()) { f.setAccessible(true); Assert.assertNotNull(f.getName(), f.get(ale)); } for (Method m : AuditLogEntry.class.getDeclaredMethods()) { if (m.getParameterTypes().length == 0 && m.getName().startsWith("get")) { Assert.assertNotNull(m.invoke(ale)); } } }
public Application.Name getApplicationName() { return applicationName; }
AuditLogEntry { public Application.Name getApplicationName() { return applicationName; } }
AuditLogEntry { public Application.Name getApplicationName() { return applicationName; } AuditLogEntry(Calendar time, UserInfo user, AuditLogAction action);  AuditLogEntry(Calendar time, UserInfo user, AuditLogAction action,
                         ExperimentBase experiment,
                         Bucket.Label bucketLabel,
                         String changedProperty, String before, String after);  AuditLogEntry(Calendar time, UserInfo user,
                         AuditLogAction action, Application.Name applicationName,
                         Experiment.Label experimentLabel, Experiment.ID experimentId,
                         Bucket.Label bucketLabel,
                         String changedProperty, String before, String after); }
AuditLogEntry { public Application.Name getApplicationName() { return applicationName; } AuditLogEntry(Calendar time, UserInfo user, AuditLogAction action);  AuditLogEntry(Calendar time, UserInfo user, AuditLogAction action,
                         ExperimentBase experiment,
                         Bucket.Label bucketLabel,
                         String changedProperty, String before, String after);  AuditLogEntry(Calendar time, UserInfo user,
                         AuditLogAction action, Application.Name applicationName,
                         Experiment.Label experimentLabel, Experiment.ID experimentId,
                         Bucket.Label bucketLabel,
                         String changedProperty, String before, String after); UserInfo getUser(); Calendar getTime(); String getTimeString(); AuditLogAction getAction(); Application.Name getApplicationName(); Experiment.Label getExperimentLabel(); Experiment.ID getExperimentId(); Bucket.Label getBucketLabel(); String getChangedProperty(); String getBefore(); String getAfter(); @Override String toString(); }
AuditLogEntry { public Application.Name getApplicationName() { return applicationName; } AuditLogEntry(Calendar time, UserInfo user, AuditLogAction action);  AuditLogEntry(Calendar time, UserInfo user, AuditLogAction action,
                         ExperimentBase experiment,
                         Bucket.Label bucketLabel,
                         String changedProperty, String before, String after);  AuditLogEntry(Calendar time, UserInfo user,
                         AuditLogAction action, Application.Name applicationName,
                         Experiment.Label experimentLabel, Experiment.ID experimentId,
                         Bucket.Label bucketLabel,
                         String changedProperty, String before, String after); UserInfo getUser(); Calendar getTime(); String getTimeString(); AuditLogAction getAction(); Application.Name getApplicationName(); Experiment.Label getExperimentLabel(); Experiment.ID getExperimentId(); Bucket.Label getBucketLabel(); String getChangedProperty(); String getBefore(); String getAfter(); @Override String toString();  }