Check out this example I put together using a jsFiddle with Java and Selenium.
The HTML snippet
<p id="1">lorum ipsum dolor sit amet</p>
<p id="2">lorum ipsum <div style="display:none">dolor sit amet</div></p>
The Java code
String expectedString = "lorum ipsum dolor sit amet";
WebDriver driver = new FirefoxDriver();
driver.get("https://jsfiddle.net/JeffC/t7scm8tg/1/");
driver.switchTo().frame("result");
String actual1 = driver.findElement(By.id("1")).getText().trim();
String actual2 = driver.findElement(By.id("2")).getText().trim();
System.out.println("actual1: " + actual1);
System.out.println("actual2: " + actual2);
System.out.println("PASS: " + expectedString.equals(actual1));
System.out.println("PASS: " + expectedString.equals(actual2));
The Result
actual1: lorum ipsum dolor sit amet
actual2: lorum ipsum
PASS: true
PASS: false
Selenium doesn't fetch hidden text, so make sure to compare the fetched text with your expected string to validate visibility.