test_class.declarator: thrown = ExpectedException.none()
test_class.modifier: @Rule
  	public final
test_class.original_string: @Rule
  	public final ExpectedException thrown = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.file: services/src/test/java/com/greensopinion/finance/services/transaction/SgmlReaderTest.java
test_class.identifier: SgmlReaderTest
test_case.body: @Test
  	public void malformedDataWithGt() throws IOException {
  		SgmlReader reader = newReader("A>");
  		thrown.expect(InvalidFileFormatException.class);
  		reader.readToken();
  	}
test_case.class_method_signature: SgmlReaderTest.malformedDataWithGt()
test_case.full_signature: @Test public void malformedDataWithGt()
test_case.identifier: malformedDataWithGt
test_case.invocations: newReader expect readToken
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void malformedDataWithGt()
focal_class.declarator: reader
focal_class.modifier: private final
focal_class.original_string: private final PushbackReader reader;
focal_class.type: PushbackReader
focal_class.var_name: reader
focal_class.declarator: buffer = new StringBuilder()
focal_class.modifier: private final
focal_class.original_string: private final StringBuilder buffer = new StringBuilder();
focal_class.type: StringBuilder
focal_class.var_name: buffer
focal_class.file: services/src/main/java/com/greensopinion/finance/services/transaction/SgmlReader.java
focal_class.identifier: SgmlReader
focal_class.interfaces: implements Closeable
focal_class.class_method_signature: SgmlReader.SgmlReader(Reader reader)
focal_class.full_signature: public  SgmlReader(Reader reader)
focal_class.identifier: SgmlReader
focal_class.modifiers: public
focal_class.parameters: (Reader reader)
focal_class.signature:  SgmlReader(Reader reader)
focal_class.class_method_signature: SgmlReader.readToken()
focal_class.full_signature: public Token readToken()
focal_class.identifier: readToken
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Token
focal_class.signature: Token readToken()
focal_class.class_method_signature: SgmlReader.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_method.body: public Token readToken() throws IOException {
  		buffer.delete(0, buffer.length());
  		TokenType tokenType = null;
  		int c;
  		while ((c = reader.read()) != -1) {
  			switch (c) {
  			case '<':
  				if (tokenType == null) {
  					tokenType = TokenType.OPEN_TAG;
  				} else if (tokenType == TokenType.DATA) {
  					reader.unread(c);
  					return new Token(tokenType, buffer.toString().trim());
  				} else {
  					throw new InvalidFileFormatException("Unexpected character '<'");
  				}
  				break;
  			case '/':
  				if (tokenType == TokenType.OPEN_TAG && buffer.toString().trim().length() == 0) {
  					tokenType = TokenType.CLOSE_TAG;
  				} else if (tokenType == TokenType.DATA) {
  					buffer.append((char) c);
  				} else {
  					throw new InvalidFileFormatException("Unexpected character '/'");
  				}
  				break;
  			case '>':
  				if (tokenType == TokenType.OPEN_TAG || tokenType == TokenType.CLOSE_TAG) {
  					String tagName = buffer.toString();
  					if (tagName.length() == 0) {
  						throw new InvalidFileFormatException(format("Invalid tag \"{0}\"", tagName));
  					}
  					return new Token(tokenType, tagName);
  				} else {
  					throw new InvalidFileFormatException("Unexpected character '>'");
  				}
  			case '&':
  				String entity = "";
  				while ((c = reader.read()) != -1 && c != ';') {
  					entity += (char) c;
  				}
  				if (tokenType == null) {
  					tokenType = TokenType.DATA;
  				}
  				buffer.append(EntityReferences.instance().namedEntityToString(entity));
  				break;
  			default:
  				boolean isWhitespace = Character.isWhitespace((char) c);
  				if (tokenType == null) {
  					if (!isWhitespace) {
  						tokenType = TokenType.DATA;
  						buffer.append((char) c);
  					}
  				} else if ((tokenType == TokenType.OPEN_TAG || tokenType == TokenType.CLOSE_TAG) && isWhitespace) {
  					throw new InvalidFileFormatException("Unexpected whitespace");
  				} else {
  					buffer.append((char) c);
  				}
  			}
  		}
  		if (tokenType == TokenType.DATA) {
  			return new Token(tokenType, buffer.toString().trim());
  		} else if (tokenType != null) {
  			throw new InvalidFileFormatException("Unexpected end of data");
  		}
  		return null;
  	}
focal_method.class_method_signature: SgmlReader.readToken()
focal_method.full_signature: public Token readToken()
focal_method.identifier: readToken
focal_method.invocations: delete length read unread trim toString length trim toString append toString length format read append namedEntityToString instance isWhitespace append append trim toString
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Token
focal_method.signature: Token readToken()