I assume you're wondering why you're getting an error?
The dereference (dot) operator has higher precedence than the cast operator does. This means the compiler thinks you're trying to call getTestValue() before you're casting o to TestOne.
Aside from that, you shouldn't have statements of the form
Note your class does not conform to Object's contract. You're not overriding the hashCode() method in accordance with the equals() method.