### Question:
DeviceGroup extends UserDefinedEntity { public int getNumberOfDevices() { int count = 0; if (devices != null) { count = devices.size(); } return count; } DeviceGroup(final String name);  DeviceGroup(final String name, final String description); protected  DeviceGroup(); static ScheduledJobInfo createDefaultScheduledJobInfo(); final Set<Device> getDevices(); final void addDevice(final Device device); final boolean removeDevice(final Device device); final boolean removeDevice(final String deviceName); final void setPeriodicReportDelayThreshold(final long milliseconds); final long getPeriodicReportDelayThreshold(); final void setEnablePeriodicReportDelayAlert(final boolean flag); final boolean isEnablePeriodicReportDelayAlert(); final void setOnDemandReportDelayThreshold(final long milliseconds); final long getOnDemandReportDelayThreshold(); final void setEnableOnDemandReportDelayAlert(final boolean flag); final boolean isEnableOnDemandReportDelayAlert(); boolean isWaitForAppraisalCompletionEnabled(); void setWaitForAppraisalCompletionEnabled(final boolean
                                                             waitForAppraisalCompletionEnabled); ScheduledJobInfo getScheduledJobInfo(); void setScheduledJobInfo(final ScheduledJobInfo scheduledJobInfo); HealthStatus getHealthStatus(); int getNumberOfDevices(); int getNumberOfTrustedDevices(); Set<Device> getAllDevices(); static final String DEFAULT_GROUP; static final long SECOND_MS_INTERVAL; static final long MINUTE_MS_INTERVAL; static final long FIVE_MINUTES_MS_INTERVAL; static final long HOUR_MS_INTERVAL; static final long DAY_MS_INTERVAL; static final long DEFAULT_REPORT_DELAY_THRESHOLD; static final long MINIMUM_PERIODIC_REPORT_INTERVAL; static final long MINIMUM_THRESHOLD_INTERVAL_MS; static final long DEFAULT_JOB_FREQUENCY_MS; }### Answer:
@Test public void testGetNumberOfDevices() throws Exception { final int numDevices = 3; DeviceGroup deviceGroup = new DeviceGroup("TestDeviceGroup"); Device device1 = DeviceTest.getTestDevice("d1"); Device device2 = DeviceTest.getTestDevice("d2"); Device device3 = DeviceTest.getTestDevice("d3"); deviceGroup.addDevice(device1); deviceGroup.addDevice(device2); deviceGroup.addDevice(device3); Assert.assertEquals(deviceGroup.getNumberOfDevices(), numDevices); }