DeviceRepository { public List<Device> find(String id) throws DeviceException { return find(id, false, 0); } DeviceRepository(RemoteStorage remoteStorage); Device addDevice(String owner, String model, String label, String log); boolean deleteDevice(String id, String log); List<Device> find(String id); List<Device> find(String id, boolean fetchDescription, int offset); Device update(Device update, String log); List<Device> findAllDevices(int offset); static XmlStreamEditor getMixDescriptionEditor(FedoraObject robj); static XmlStreamEditor getPremisDescriptionEditor(FedoraObject robj); XmlStreamEditor getDescriptionEditor(String id); Mets repairNkComplexType(Mets mets); static final String DESCRIPTION_DS_ID; static final String AUDIODESCRIPTION_DS_ID; static final String DESCRIPTION_DS_LABEL; static final String AUDIO_DESCRIPTION_DS_LABEL; static final String METAMODEL_ID; static final String METAMODEL_AUDIODEVICE_ID; static final String METAMODEL_ID_LABEL; static final String METAMODEL_AUDIODEVICE_ID_LABEL; }
@Test public void testFindAll() throws Exception { Device expected = addTestDevice("testFindAll"); List<Device> result = repository.find(null); String dump = String.valueOf(result); assertFalse(dump, result.isEmpty()); int matches = 0; for (Device device : result) { if (expected.getId().equals(device.getId())) { ++matches; } } assertEquals(dump, 1, matches); }
@Test public void testFind() throws Exception { Device expected = addTestDevice("testFind"); List<Device> result = repository.find(expected.getId()); assertDeviceEquals(expected, result); }