### Question:
EndpointHelper { public static Endpoint lookupEndpoint(EndpointKey epKey, ReadOnlyTransaction transaction) { Optional<Endpoint> optionalEp = readFromDs(LogicalDatastoreType.OPERATIONAL, endpointIid(epKey.getL2Context(), epKey.getMacAddress()), transaction); if (optionalEp.isPresent()) { return optionalEp.get(); } return null; }  static Endpoint lookupEndpoint(EndpointKey epKey, ReadOnlyTransaction transaction); static void updateEndpointWithLocation(Endpoint endpoint, String nodeIdString, String nodeConnectorIdString,
            ReadWriteTransaction rwTx); static void updateEndpointRemoveLocation(Endpoint endpoint, ReadWriteTransaction rwTx);  }### Answer:
@Test public void testLookupEndpoint() { when(readOptional.isPresent()).thenReturn(true); when(readOptional.get()).thenReturn(endpoint); Endpoint result = EndpointHelper.lookupEndpoint(epKey, readTransaction); assertEquals(result, endpoint); }
@Test public void testLookupEndpoint_NotPresent() { when(readOptional.isPresent()).thenReturn(false); Endpoint result = EndpointHelper.lookupEndpoint(epKey, readTransaction); assertNull(result); }