public static AgentRuntimeInfo fromServer(Agent agent, boolean registeredAlready, String location,
                                              Long freeDiskSpace, String operatingSystem ) {

        if (isEmpty(location)) {
            throw new RuntimeException("Agent should not register without installation path.");
        }

        AgentStatus status = Pending;
        if (isLocalIpAddress(agent.getIpaddress()) || registeredAlready) {
            status = AgentStatus.Idle;
        }

        AgentRuntimeStatus runtimeStatus = status.getRuntimeStatus();
        AgentIdentifier identifier = agent.getAgentIdentifier();
        AgentRuntimeInfo runtimeInfo = new AgentRuntimeInfo(identifier, runtimeStatus, location, null);
        runtimeInfo.setUsableSpace(freeDiskSpace);
        runtimeInfo.operatingSystemName = operatingSystem;
        return runtimeInfo;
    }
@Test
    public void shouldNotMatchRuntimeInfosWithDifferentOperatingSystems() {
        AgentRuntimeInfo linux = AgentRuntimeInfo.fromServer(new Agent("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");
        AgentRuntimeInfo osx = AgentRuntimeInfo.fromServer(new Agent("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "foo bar");
        assertThat(linux, is(not(osx)));
    }