@Test public void testAllButOneMonitorsDisconnected() { Collection<GWTLocationMonitor> monitors = new ArrayList<GWTLocationMonitor>(); for (int i = 0; i < 5; i++) { monitors.add(getMonitor("DISCONNECTED")); } LocationMonitorState lms = new LocationMonitorState(monitors, null); assertFalse("all monitors should be DISCONNECTED", lms.allButOneMonitorsDisconnected()); monitors.add(getMonitor("STARTED")); lms = new LocationMonitorState(monitors, null); assertTrue("all but one monitors are DISCONNECTED", lms.allButOneMonitorsDisconnected()); monitors.add(getMonitor("CONFIG_CHANGED")); lms = new LocationMonitorState(monitors, null); assertFalse("more than one monitor is STARTED or CONFIG_CHANGED", lms.allButOneMonitorsDisconnected()); }
public boolean allButOneMonitorsDisconnected() { if (m_monitorsDisconnected.size() == 0) { return false; } if (m_monitorsStarted.size() > 1) { return false; } if (m_monitorsStarted.size() == 0) { return false; } return true; }
LocationMonitorState implements Serializable, IsSerializable { public boolean allButOneMonitorsDisconnected() { if (m_monitorsDisconnected.size() == 0) { return false; } if (m_monitorsStarted.size() > 1) { return false; } if (m_monitorsStarted.size() == 0) { return false; } return true; } }
LocationMonitorState implements Serializable, IsSerializable { public boolean allButOneMonitorsDisconnected() { if (m_monitorsDisconnected.size() == 0) { return false; } if (m_monitorsStarted.size() > 1) { return false; } if (m_monitorsStarted.size() == 0) { return false; } return true; } LocationMonitorState();  LocationMonitorState(Collection<GWTLocationSpecificStatus> statuses);  LocationMonitorState(Collection<GWTLocationMonitor> monitors, Collection<GWTLocationSpecificStatus> statuses); }
LocationMonitorState implements Serializable, IsSerializable { public boolean allButOneMonitorsDisconnected() { if (m_monitorsDisconnected.size() == 0) { return false; } if (m_monitorsStarted.size() > 1) { return false; } if (m_monitorsStarted.size() == 0) { return false; } return true; } LocationMonitorState();  LocationMonitorState(Collection<GWTLocationSpecificStatus> statuses);  LocationMonitorState(Collection<GWTLocationMonitor> monitors, Collection<GWTLocationSpecificStatus> statuses); StatusDetails getStatusDetails(); boolean allMonitorsStarted(); boolean atLeastOneMonitorStarted(); boolean allButOneMonitorsDisconnected(); boolean allMonitorsDisconnected(); boolean noMonitorsStarted(); int getMonitorsStarted(); int getMonitorsStopped(); int getMonitorsDisconnected(); Collection<GWTMonitoredService> getServices(); Collection<String> getServicesDown(); Collection<GWTLocationMonitor> getMonitorsWithServicesDown(); boolean noMonitorsExist(); String toString(); }
LocationMonitorState implements Serializable, IsSerializable { public boolean allButOneMonitorsDisconnected() { if (m_monitorsDisconnected.size() == 0) { return false; } if (m_monitorsStarted.size() > 1) { return false; } if (m_monitorsStarted.size() == 0) { return false; } return true; } LocationMonitorState();  LocationMonitorState(Collection<GWTLocationSpecificStatus> statuses);  LocationMonitorState(Collection<GWTLocationMonitor> monitors, Collection<GWTLocationSpecificStatus> statuses); StatusDetails getStatusDetails(); boolean allMonitorsStarted(); boolean atLeastOneMonitorStarted(); boolean allButOneMonitorsDisconnected(); boolean allMonitorsDisconnected(); boolean noMonitorsStarted(); int getMonitorsStarted(); int getMonitorsStopped(); int getMonitorsDisconnected(); Collection<GWTMonitoredService> getServices(); Collection<String> getServicesDown(); Collection<GWTLocationMonitor> getMonitorsWithServicesDown(); boolean noMonitorsExist(); String toString();  }