If your tooltip text is produced by HTML title attribute:
Usually tooltip text is specified in title attribute of an element. You can get the same by identifying the element and getting the title attribute.
E.g.
WebElement element = driver.findElement(By.cssSelector(".your text box"));
String toolTipText = element.getAttribute("title");
If your tooltip text is produced by JQuery:
It will not be a part of title attribute, it will actually highlight the div tag. In that case, you can use the Actions class to identify tool tip text.
E.g.
First, you have to mouse over to the element.
Actions action = new Actions(driver);
WebElement element = driver.findElement(By.id("the text box"));
actions.moveToElement(element).build().perform();
Now you can get the tooltip text using .ui-tooltip class.
WebElement toolTipElement = driver.findElement(By.cssSelector(".ui-tooltip"));
Assert.assertEquals("We ask for your age only for statistical purposes.", toolTipText);
Hope that helps!