More cleanup in CodeWriter
- regular file, stdout and string are all written using ostream.
- factory functions GetFileWriter and GetStringWriter are refactored
to as static member functions ForFile and ForString
Bug: 110967839
Test: m -j, device boots to the UI and basic functionality works
Test: runtest.sh is successful
Change-Id: Id2ce1b7d5c2ff740b3241313c4bc5f6bd80f07bf
diff --git a/ast_java_unittest.cpp b/ast_java_unittest.cpp
index b2aad23..a9baf37 100644
--- a/ast_java_unittest.cpp
+++ b/ast_java_unittest.cpp
@@ -53,8 +53,7 @@
a_class.extends = &extend_type;
string actual_output;
- CodeWriterPtr writer = GetStringWriter(&actual_output);
- a_class.Write(writer.get());
+ a_class.Write(CodeWriter::ForString(&actual_output).get());
EXPECT_EQ(string(kExpectedClassOutput), actual_output);
}