Environment { public static Environment Parse(String toStringRepresentation) throws NeedToDeleteAndRecreateTriggerException { final Integer DONT_REMOVE_EMPTY_VALUES = -1; final String[] split = toStringRepresentation.split(";", DONT_REMOVE_EMPTY_VALUES); if (split.length < 4) throw new NeedToDeleteAndRecreateTriggerException(); final String environmentId = split[0]; final OctopusDate latestDeployment = OctopusDate.Parse(split[1]); final OctopusDate latestSuccessfulDeployment = OctopusDate.Parse(split[2]); final String releaseId = split[3]; final String deploymentId = split[4]; final String version = split[5]; final String projectId = split[6]; return new Environment(environmentId, latestDeployment, latestSuccessfulDeployment, releaseId, deploymentId, version, projectId); } Environment(@NotNull String environmentId,
                       @NotNull OctopusDate latestDeployment,
                       @NotNull OctopusDate latestSuccessfulDeployment,
                       @NotNull String releaseId,
                       @NotNull String deploymentId,
                       @NotNull String version,
                       @NotNull String projectId); boolean isLatestDeploymentOlderThan(OctopusDate compareDate); boolean isLatestSuccessfulDeploymentOlderThen(OctopusDate compareDate); boolean wasLatestDeploymentSuccessful(); boolean hasHadAtLeastOneSuccessfulDeployment(); void update(OctopusDate latestDeployment, Boolean finishedSuccessfully); @Override String toString(); static Environment Parse(String toStringRepresentation); @Override boolean equals(Object obj); boolean isLatestSuccessfulDeploymentNewerThan(OctopusDate compareDate); static Environment Parse(Map map); static Environment CreateFrom(Deployment deployment, ApiTaskResponse task, ApiReleaseResponse release); @NotNull
    final String environmentId; @NotNull
    public OctopusDate latestDeployment; @NotNull
    public OctopusDate latestSuccessfulDeployment; }
@Test(expectedExceptions = NeedToDeleteAndRecreateTriggerException.class) public void parse_string_throws_exception_if_format_is_different() throws NeedToDeleteAndRecreateTriggerException { Environment.Parse("env-id;2015-12-09T14:10:11.000+00:00;2015-12-12T09:04:03.000+00:00"); }