test_class.declarator: polygonEncoder = new PolygonEncoder()
test_class.modifier: private
test_class.original_string: private PolygonEncoder polygonEncoder = new PolygonEncoder();
test_class.type: PolygonEncoder
test_class.var_name: polygonEncoder
test_class.file: proto/src/test/java/openlr/proto/encoder/PolygonEncoderTest.java
test_class.identifier: PolygonEncoderTest
test_case.body: @Test
      public void testEncodePolygon() throws OpenLRProtoException {
          List<GeoCoordinates> geoCoordinates = new ArrayList<>();
          geoCoordinates.add(new GeoCoordinatesProtoImpl(-122.915, 39.045));
          geoCoordinates.add(new GeoCoordinatesProtoImpl(-122.914, 39.046));
          geoCoordinates.add(new GeoCoordinatesProtoImpl(-122.913, 39.047));
  
          RawPolygonLocRef rawLocationReference = new RawPolygonLocRef("1", geoCoordinates);
  
          LocationReference locationReference = polygonEncoder.encode(rawLocationReference);
  
          assertNotNull(locationReference);
          assertEquals(locationReference.getID(), "1");
          assertEquals(locationReference.getLocationType(), LocationType.POLYGON);
          assertEquals(locationReference.getDataIdentifier(), "proto");
          assertEquals(locationReference.getDataClass(), LocationReferenceData.class);
  
          Object locationReferenceData = locationReference.getLocationReferenceData();
  
          assertTrue(locationReferenceData instanceof LocationReferenceData);
  
          LocationReferenceData data = (LocationReferenceData) locationReferenceData;
  
          assertTrue(data.hasPolygonLocationReference());
  
          PolygonLocationReference polygonLocationReference = data.getPolygonLocationReference();
  
          List<Coordinates> coordinatesList = polygonLocationReference.getCoordinatesList();
  
          assertEquals(coordinatesList.size(), 3);
  
          Coordinates first = coordinatesList.get(0);
          assertNotNull(first);
          assertEquals(first.getLongitude(), -122.915);
          assertEquals(first.getLatitude(), 39.045);
  
          Coordinates second = coordinatesList.get(1);
          assertNotNull(second);
          assertEquals(second.getLongitude(), -122.914);
          assertEquals(second.getLatitude(), 39.046);
  
          Coordinates third = coordinatesList.get(2);
          assertNotNull(third);
          assertEquals(third.getLongitude(), -122.913);
          assertEquals(third.getLatitude(), 39.047);
      }
test_case.class_method_signature: PolygonEncoderTest.testEncodePolygon()
test_case.full_signature: @Test public void testEncodePolygon()
test_case.identifier: testEncodePolygon
test_case.invocations: add add add encode assertNotNull assertEquals getID assertEquals getLocationType assertEquals getDataIdentifier assertEquals getDataClass getLocationReferenceData assertTrue assertTrue hasPolygonLocationReference getPolygonLocationReference getCoordinatesList assertEquals size get assertNotNull assertEquals getLongitude assertEquals getLatitude get assertNotNull assertEquals getLongitude assertEquals getLatitude get assertNotNull assertEquals getLongitude assertEquals getLatitude
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEncodePolygon()
focal_class.file: proto/src/main/java/openlr/proto/encoder/PolygonEncoder.java
focal_class.identifier: PolygonEncoder
focal_class.interfaces: implements LocationReferenceEncoder
focal_class.class_method_signature: PolygonEncoder.encode(RawLocationReference rawLocationReference)
focal_class.full_signature: @Override public LocationReference encode(RawLocationReference rawLocationReference)
focal_class.identifier: encode
focal_class.modifiers: @Override public
focal_class.parameters: (RawLocationReference rawLocationReference)
focal_class.return: LocationReference
focal_class.signature: LocationReference encode(RawLocationReference rawLocationReference)
focal_method.body: @Override
      public LocationReference encode(RawLocationReference rawLocationReference) throws OpenLRProtoException {
          if (rawLocationReference.getLocationType() != LocationType.POLYGON) {
              throw new OpenLRProtoException(OpenLRProtoStatusCode.INVALID_LOCATION_REFERENCE);
          }
  
          List<Coordinates> coordinates = new ArrayList<>();
  
          for (GeoCoordinates cornerPoint : rawLocationReference.getCornerPoints()) {
              Coordinates c = Coordinates.newBuilder()
                      .setLongitude(cornerPoint.getLongitudeDeg())
                      .setLatitude(cornerPoint.getLatitudeDeg())
                      .build();
              coordinates.add(c);
          }
  
          PolygonLocationReference polygonLocationReference = PolygonLocationReference.newBuilder()
                  .addAllCoordinates(coordinates)
                  .build();
  
          LocationReferenceData locationReferenceData = LocationReferenceData.newBuilder()
                  .setPolygonLocationReference(polygonLocationReference)
                  .build();
  
          return new LocationReferenceProtoImpl(rawLocationReference.getID(), LocationType.POLYGON, locationReferenceData);
      }
focal_method.class_method_signature: PolygonEncoder.encode(RawLocationReference rawLocationReference)
focal_method.full_signature: @Override public LocationReference encode(RawLocationReference rawLocationReference)
focal_method.identifier: encode
focal_method.invocations: getLocationType getCornerPoints build setLatitude setLongitude newBuilder getLongitudeDeg getLatitudeDeg add build addAllCoordinates newBuilder build setPolygonLocationReference newBuilder getID
focal_method.modifiers: @Override public
focal_method.parameters: (RawLocationReference rawLocationReference)
focal_method.return: LocationReference
focal_method.signature: LocationReference encode(RawLocationReference rawLocationReference)