### Question:
VObjectFactoryImpl extends RecordFactoryImpl<VObject, VObjectImpl> implements VObjectFactory { public List<VObject> searchObjects(String inName, Set<HARDWARE> inHardwares, String inCity, String inCountry, int skip, int count) { final StringBuilder theCondition = new StringBuilder(" object.object_id = object_preferences.object_id AND object_preferences.visible = ? AND object.object_id = object_profile.object_id "); final List<String> joinTables = new LinkedList<String>(); final List<Object> theValues = new LinkedList<Object>(); joinTables.add("object_preferences"); joinTables.add("object_profile"); theValues.add(true); if (inName != null) { theCondition.append(" and object_label like ? "); theValues.add(inName + "%"); } if ((inHardwares != null) && !inHardwares.isEmpty()) { final Iterator<Hardware.HARDWARE> theIterator = inHardwares.iterator(); if (theIterator.hasNext()) { theCondition.append(" and object_hardware in (" + theIterator.next().getId()); while (theIterator.hasNext()) { theCondition.append(" , " + theIterator.next().getId()); } theCondition.append(" ) "); } } if ((inCity != null) || (inCountry != null)) { joinTables.add("annu"); theCondition.append(" and object.object_owner = annu.annu_user "); if (inCity != null) { theCondition.append(" AND annu.annu_city = ? "); theValues.add(inCity); } if (inCountry != null) { theCondition.append(" AND annu_country = ? "); theValues.add(inCountry); } } return findAll(joinTables.toArray(new String[joinTables.size()]), theCondition.toString(), theValues, "object_label", skip, count); } VObjectFactoryImpl(); VObject findByName(String inName); List<VObject> findByOwner(User owner); VObject findBySerial(String inSerial); VObject findByJID(String inJID); VObject findByOwnerAndHardware(User owner, HARDWARE inHardware); VObject findRandomObject(); List<VObject> findLastCreatedByHardwares(int count, Set<HARDWARE> hardwares); List<VObject> searchObjects(String inName, Set<HARDWARE> inHardwares, String inCity, String inCountry, int skip, int count); ObjectProfile createObjectProfile(VObject inObject); ObjectPreferences createObjectPreferences(VObject inObject, Lang inLang); VObject createObject(HARDWARE inHardware, String inSerial, String inName, String inLabel, User inUser, String inLocation, int inMode, int inState, Files inPicture); ObjectPreferences createObjectPreferences(VObject inObject, Lang inLang, boolean inVisibilty); VObject findByNameAndMD5Password(String inName, String inPassword); int walkObjectsStatus(RecordWalker<VObject> inWalker, Timezone inTimezone, boolean postStateActif);  }### Answer:
@Test public void searchObjectsTest() { final Set<Hardware.HARDWARE> theHardwares = new HashSet<Hardware.HARDWARE>(Arrays.asList(Hardware.HARDWARE.V1, Hardware.HARDWARE.V2)); final List<VObject> theObjects = Factories.VOBJECT.searchObjects("ObjFactImpl", theHardwares, "Varsovie", "PL", 0, 10); Assert.assertNotNull(theObjects); Assert.assertEquals(2, theObjects.size()); Assert.assertEquals("ObjFactImpl", theObjects.get(0).getObject_login()); final List<VObject> theObjects2 = Factories.VOBJECT.searchObjects(null, null, "Varsovie", "PL", 0, 10); Assert.assertEquals(3, theObjects2.size()); }