To advance Java programming educations, we have developed the Java Programming Learning Assistant System (JPLAS) that provides the code writing problem. This problem asks a student to write a source code to satisfy the specification of a given assignment, where the correctness is verified by running test code on JUnit. For a novice student, a code of implementing the standard input/output with the exception handling should be mastered at the early stage as the first step programming for human interfaces. However, for a teacher, it is not easy to write the test code for it. In this paper, we propose a test code generation method to generate the test code using the reference source code for the assignment. In the evaluation of this proposal, all the students completed the codes using the generated test codes for exception handling, although the use of exception handling functions was sometimes insufficient or incorrect.