@Test
	public void testReportDuplicate() throws Exception{
		ParkedUsers garage = ParkedUsers.getInstance();
		ParkingSpot spot = garage.searchBySpotNumber("312");
		spot.setPrintWriter(new PrintWriter(System.out));		//2223432
		
		
		String testedSpot = "312";
        String userType = "student";
        String testedID = "2223432";
        String expectValid = "Valid Request ";
        String expectAssign = "Assigning student parking spot";
        String direction = "Student";
		
		WelcomeDisplay wDisp = PowerMock.createMock(WelcomeDisplay.class);
        PowerMock.expectNew(WelcomeDisplay.class).andReturn(wDisp).anyTimes();
        ParkingNotification pDisp = PowerMock.createMock(ParkingNotification.class);
        PowerMock.expectNew(ParkingNotification.class).andReturn(pDisp).anyTimes();
        SpotNumberDisplay sDisp = PowerMock.createMock(SpotNumberDisplay.class);
        PowerMock.expectNew(SpotNumberDisplay.class).andReturn(sDisp).anyTimes();
        DisplayDirections dDisp = PowerMock.createMock(DisplayDirections.class);
        PowerMock.expectNew(DisplayDirections.class).andReturn(dDisp).anyTimes();
        
        TestEntranceDisplayController.runDisplayMockSetup(wDisp, pDisp, sDisp, dDisp, spot, userType, testedID, expectValid, expectAssign, direction);
        
        expectValid = "Duplicate ID! ";
        expectAssign = "Press next to notify the security officer";
        direction = "Student";
        
        TestEntranceDisplayController.runDisplayMockSetup(wDisp,pDisp,sDisp,dDisp,spot,userType,testedID,expectValid,expectAssign,direction);
        PowerMock.replay(wDisp, WelcomeDisplay.class, pDisp, ParkingNotification.class, sDisp, SpotNumberDisplay.class, dDisp, DisplayDirections.class);
		
		
        
		ThreadDriver thread = new ThreadDriver();
		thread.start();
        
		
		SpotStub stub = new SpotStub("security", 3738);
		stub.start();
		
		
		String ans = "";
		int x = 0;
		while(x != -1 && x < 100){ //if no response is received in 10 seconds, test is deemed failed.
            x++;
            stub.setReListen();
            sleep(100);
            ans = stub.getAnswer();
            sleep(100);
            if(ans.equals("duplicate")){
                x = -1;
            }
            else{
            	System.out.println(ans);
            }
        }
        assertEquals("duplicate",ans);
        stub.quit();
	}