# LocationSubject

Artifact: [androidx.test.ext:truth](https://developer.android.com/jetpack/androidx/releases/test-ext) [View Source](https://cs.android.com/search?q=file:androidx/test/ext/truth/location/LocationSubject.java+class:androidx.test.ext.truth.location.LocationSubject)

*** ** * ** ***

<br />

```
public class LocationSubject extends Subject
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [com.google.common.truth.Subject](https://truth.dev/api/0.41/com/google/common/truth/Subject.html) ||
|   | ↳ | [androidx.test.ext.truth.location.LocationSubject](https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject) |

*** ** * ** ***

Subject for making assertions about `https://developer.android.com/reference/android/location/Location.html`s.

## Summary

| ### Public methods |
|---|---|
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#accuracy()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/DoubleSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#altitude()()` |
| `static https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#assertThat(android.location.Location)(https://developer.android.com/reference/android/location/Location.html location)` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#bearing()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#bearingAccuracy()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#bearingTo(android.location.Location)(https://developer.android.com/reference/android/location/Location.html location)` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#bearingTo(double,double)(double latitude, double longitude)` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#distanceTo(android.location.Location)(https://developer.android.com/reference/android/location/Location.html location)` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#distanceTo(double,double)(double latitude, double longitude)` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#doesNotHaveProvider(java.lang.String)(https://developer.android.com/reference/java/lang/String.html provider)` |
| `https://truth.dev/api/0.41/com/google/common/truth/LongSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#elapsedRealtimeMillis()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/LongSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#elapsedRealtimeNanos()()` |
| `final https://developer.android.com/reference/androidx/test/ext/truth/os/BundleSubject` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#extras()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasAccuracy()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasAltitude()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasBearing()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasBearingAccuracy()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasProvider(java.lang.String)(https://developer.android.com/reference/java/lang/String.html provider)` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasSpeed()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasSpeedAccuracy()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#hasVerticalAccuracy()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isAt(android.location.Location)(https://developer.android.com/reference/android/location/Location.html other)` Verifies that the location is at the same latitude/longitude as another location. |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isAt(double,double)(double latitude, double longitude)` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isEqualTo(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html otherObj)` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isFaraway(android.location.Location,float)(https://developer.android.com/reference/android/location/Location.html other, float distanceM)` Verifies that the location is at least `distanceM` meters away from another location. |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isMock()()` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isNearby(android.location.Location,float)(https://developer.android.com/reference/android/location/Location.html other, float distanceM)` Verifies that the location is at most `distanceM` meters away from another location. |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isNotAt(android.location.Location)(https://developer.android.com/reference/android/location/Location.html other)` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isNotAt(double,double)(double latitude, double longitude)` |
| `void` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#isNotMock()()` |
| `static https://truth.dev/api/0.41/com/google/common/truth/Subject.Factory.html<https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject, https://developer.android.com/reference/android/location/Location.html>` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#locations()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#speed()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#speedAccuracy()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/LongSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#time()()` |
| `https://truth.dev/api/0.41/com/google/common/truth/FloatSubject.html` | `https://developer.android.com/reference/androidx/test/ext/truth/location/LocationSubject#verticalAccuracy()()` |

### Inherited methods

From [com.google.common.truth.Subject](https://truth.dev/api/0.41/com/google/common/truth/Subject.html) `https://developer.android.com/reference/java/lang/String.html` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#actualCustomStringRepresentation--()` `final boolean` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#equals-java.lang.Object-(https://developer.android.com/reference/java/lang/Object.html o)`

**This method is deprecated.**
`final void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#failWithActual-java.lang.String-java.lang.Object-(https://developer.android.com/reference/java/lang/String.html key, https://developer.android.com/reference/java/lang/Object.html value)` `final void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#failWithoutActual-com.google.common.truth.Fact-com.google.common.truth.Fact...-(https://truth.dev/api/0.41/com/google/common/truth/Fact.html first, Fact[] rest)` `final int` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#hashCode--()`

**This method is deprecated.**
`final https://truth.dev/api/0.41/com/google/common/truth/StandardSubjectBuilder.html` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#ignoreCheck--()` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isAnyOf-java.lang.Object-java.lang.Object-java.lang.Object...-(https://developer.android.com/reference/java/lang/Object.html first, https://developer.android.com/reference/java/lang/Object.html second, Object[] rest)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isIn-java.lang.Iterable&lt;?&gt;-(https://developer.android.com/reference/java/lang/Iterable.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> iterable)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isInstanceOf-java.lang.Class&lt;?&gt;-(https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> clazz)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNoneOf-java.lang.Object-java.lang.Object-java.lang.Object...-(https://developer.android.com/reference/java/lang/Object.html first, https://developer.android.com/reference/java/lang/Object.html second, Object[] rest)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNotEqualTo-java.lang.Object-(https://developer.android.com/reference/java/lang/Object.html unexpected)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNotIn-java.lang.Iterable&lt;?&gt;-(https://developer.android.com/reference/java/lang/Iterable.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> iterable)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNotInstanceOf-java.lang.Class&lt;?&gt;-(https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> clazz)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNotNull--()` `final void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNotSameInstanceAs-java.lang.Object-(https://developer.android.com/reference/java/lang/Object.html unexpected)` `void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isNull--()` `final void` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#isSameInstanceAs-java.lang.Object-(https://developer.android.com/reference/java/lang/Object.html expected)` `https://developer.android.com/reference/java/lang/String.html` `https://truth.dev/api/0.41/com/google/common/truth/Subject.html#toString--()`

## Public methods

### accuracy

```
public FloatSubject accuracy()
```

### altitude

```
public DoubleSubject altitude()
```

### assertThat

```
public static LocationSubject assertThat(Location location)
```

### bearing

```
public FloatSubject bearing()
```

### bearingAccuracy

```
public FloatSubject bearingAccuracy()
```

### bearingTo

```
public FloatSubject bearingTo(Location location)
```

### bearingTo

```
public FloatSubject bearingTo(double latitude, double longitude)
```

### distanceTo

```
public FloatSubject distanceTo(Location location)
```

### distanceTo

```
public FloatSubject distanceTo(double latitude, double longitude)
```

### doesNotHaveProvider

```
public void doesNotHaveProvider(String provider)
```

### elapsedRealtimeMillis

```
public LongSubject elapsedRealtimeMillis()
```

### elapsedRealtimeNanos

```
public LongSubject elapsedRealtimeNanos()
```

### extras

```
public final BundleSubject extras()
```

### hasAccuracy

```
public void hasAccuracy()
```

### hasAltitude

```
public void hasAltitude()
```

### hasBearing

```
public void hasBearing()
```

### hasBearingAccuracy

```
public void hasBearingAccuracy()
```

### hasProvider

```
public void hasProvider(String provider)
```

### hasSpeed

```
public void hasSpeed()
```

### hasSpeedAccuracy

```
public void hasSpeedAccuracy()
```

### hasVerticalAccuracy

```
public void hasVerticalAccuracy()
```

### isAt

```
public void isAt(Location other)
```

Verifies that the location is at the same latitude/longitude as another location.

### isAt

```
public void isAt(double latitude, double longitude)
```

### isEqualTo

```
public void isEqualTo(@Nullable Object otherObj)
```

### isFaraway

```
public void isFaraway(Location other, float distanceM)
```

Verifies that the location is at least `distanceM` meters away from another location.

### isMock

```
public void isMock()
```

### isNearby

```
public void isNearby(Location other, float distanceM)
```

Verifies that the location is at most `distanceM` meters away from another location.

### isNotAt

```
public void isNotAt(Location other)
```

### isNotAt

```
public void isNotAt(double latitude, double longitude)
```

### isNotMock

```
public void isNotMock()
```

### locations

```
public static Subject.Factory<LocationSubject, Location> locations()
```

### speed

```
public FloatSubject speed()
```

### speedAccuracy

```
public FloatSubject speedAccuracy()
```

### time

```
public LongSubject time()
```

### verticalAccuracy

```
public FloatSubject verticalAccuracy()
```