// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps;

import com.google.cloud.vision.v1.AnnotateImageRequest;
import com.google.cloud.vision.v1.AnnotateImageResponse;
import com.google.cloud.vision.v1.BatchAnnotateImagesResponse;
import com.google.cloud.vision.v1.EntityAnnotation;
import com.google.cloud.vision.v1.Image;
import com.google.cloud.vision.v1.ImageAnnotatorClient;
import com.google.sps.data.ShoppingListTextEntry;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class FakeTextDetectionAPIImpl implements TextDetectionAPI {
    
  public List<ShoppingListTextEntry> detect(byte[] imageBytes) throws PhotoDetectionException {
      List<ShoppingListTextEntry> results = new ArrayList<>();
      if(imageBytes.length == 0) {
          throw new PhotoDetectionException("Invalid imageBytes");
      }
      else if(imageBytes.length < 10) {
          results.add(ShoppingListTextEntry.create("Grey boots for men", 100));
      }
      else if(imageBytes.length > 10) {
          results.add(ShoppingListTextEntry.create("Blue shirt for women", 98));
      }
      return results;
  }
}

@@ -611,333 +611,8 @@
 s;%0A%0A
-import com.google.cloud.vision.v1.AnnotateImageRequest;%0Aimport com.google.cloud.vision.v1.AnnotateImageResponse;%0Aimport com.google.cloud.vision.v1.BatchAnnotateImagesResponse;%0Aimport com.google.cloud.vision.v1.EntityAnnotation;%0Aimport com.google.cloud.vision.v1.Image;%0Aimport com.google.cloud.vision.v1.ImageAnnotatorClient;%0A
 impo
@@ -811,19 +811,15 @@
 %7B%0A  
-  %0A  public
+private
  Lis
@@ -853,485 +853,614 @@
 tect
-(byte%5B%5D imageBytes) throws PhotoDetectionException %7B%0A      List%3CShoppingListTextEntry%3E results = new ArrayList%3C%3E();%0A      if(imageBytes.length == 0) %7B%0A          throw new PhotoDetectionException(%22Invalid imageBytes%22);%0A      %7D%0A      else if(imageBytes.length %3C 10) %7B%0A          results.add(ShoppingListTextEntry.create(%22Grey boots for men%22, 100));%0A      %7D%0A      else if(imageBytes.length %3E 10) %7B%0A          results.add(ShoppingListTextEntry.create(%22Blue shirt for women%22, 98));%0A  
+edData;%0A  private PhotoDetectionException photoDetectionException;%0A%0A  /** Set textimage detection data to be returned. */%0A  public void setReturnValue(List%3CShoppingListTextEntry%3E detectedData) %7B%0A    this.detectedData = detectedData;%0A  %7D%0A%0A  /** Set exception to be thrown. */%0A  public void setException(PhotoDetectionException photoDetectionException) %7B%0A    this.photoDetectionException = photoDetectionException;%0A  %7D%0A%0A  public List%3CShoppingListTextEntry%3E detect(byte%5B%5D imageBytes) %0A      throws PhotoDetectionException %7B%0A    if (photoDetectionException != null) %7B%0A      throw this.photoDetectionException;%0A
     
@@ -1469,24 +1469,32 @@
     
-  
 return 
-results
+this.detectedData
 ;%0A  

Refactor fake imp