@@ -0,0 +1,2377 @@
+// Copyright 2019 Google LLC%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//     https://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0A%0Apackage javatests;%0A%0Aimport java.util.*;%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.FileNotFoundException;%0Aimport org.junit.Assert.*;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.JUnit4;%0Aimport static org.junit.Assert.assertTrue;%0Aimport data.JsonConverter;%0Aimport data.Vendor;%0A%0A/** Test the functionality of the JsonConverter class. */%0A@RunWith(JUnit4.class)%0Apublic final class JsonConverterTest %7B%0A  @Test%0A  public void testCreateFileMethod() %7B%0A    // Test that the method can create a file with content.%0A    JsonConverter converter = new JsonConverter();%0A    File file = converter.createFile();%0A%0A    String expectedFileContent = %22%7B%5C%22Vehicle%5C%22:%7B%5C%22Car%5C%22:%5C%22Blue Tacoma%5C%22%7D%7D%22;%0A    String fileContent = %22%22;%0A%0A    Scanner input;%0A    try %7B%0A      input = new Scanner(file);%0A    %7D catch(FileNotFoundException e) %7B%0A      input = null;%0A    %7D%0A%0A    while(input.hasNextLine())%0A    %7B%0A      fileContent += input.nextLine();%0A    %7D%0A%0A    // Test that the file isn't empty and has the right content.%0A    assertTrue(%22createFile() didn't add any content to the file when is should've%22,%0A      !fileContent.equals(%22%22));%0A    assertTrue(%22createFile() didn't add the right content to the file.%22, %0A      fileContent.equals(expectedFileContent));%0A  %7D%0A%0A  @Test%0A  public void testUpdateFileMethod() throws IOException %7B%0A    // For the protoype, updateFile() calls createFile() and returns true.%0A    JsonConverter converter = new JsonConverter();%0A    Vendor vendor = new Vendor();%0A%0A    boolean expectedResponse = true;%0A    boolean actualResponse = converter.updateFile(vendor);%0A%0A    // Test that the actual and expected responses are the same.%0A    assertTrue(%22updateFile() didn't return true when it should have.%22, %0A      expectedResponse == actualResponse);%0A  %7D%0A%7D%0A

add a test class for JsonConverter