brapi-java-client/src/test/java/org/brapi/client/v2/modules/phenotype/ObservationUnitsApiTest.java
@Test
	@Order(1)
	public void searchObservationunitsPostTest() throws ApiException {
		// Likely isn't going to return anything. Just testing whether search result vs data result is parsed correctly.
		BrAPIObservationUnitSearchRequest body = new BrAPIObservationUnitSearchRequest();
		body.addProgramDbIdsItem("1");

		ApiResponse<Pair<Optional<BrAPIObservationUnitListResponse>, Optional<BrAPIAcceptedSearchResponse>>> response = api.searchObservationunitsPost(body);

		Pair<Optional<BrAPIObservationUnitListResponse>, Optional<BrAPIAcceptedSearchResponse>> responseBody = response.getBody();
		Optional<BrAPIObservationUnitListResponse> listResponse = responseBody.getLeft();
		Optional<BrAPIAcceptedSearchResponse> searchResponse = responseBody.getRight();
		if (listResponse.isPresent()) {
			assertTrue(listResponse.get() != null, "data body was null");
			BrAPIObservationUnitListResponseResult result = listResponse.get().getResult();
			assertTrue(result.getData() != null, "No data object was returned in body");
		} else {
			// Check our searchResultDbId was passed
			assertTrue(searchResponse.get() != null, "search body was null");
			BrAPIAcceptedSearchResponse resp = searchResponse.get();
			BrAPIAcceptedSearchResponseResult result = resp.getResult();
			assertTrue(result.getSearchResultsDbId() != null, "No search id was returned in body");
			searchResultDbId = result.getSearchResultsDbId();
		}
	}
/**
	 * Submit a search request for Observation Units
	 *
	 * Returns a list of observationUnit with the observed Phenotypes. See Search
	 * Services for additional implementation details. Use case - this section
	 * allows to get a dataset from multiple studies. It allows to integrate data
	 * from several databases. Example Use cases - Study a panel of germplasm across
	 * multiple studies - Get all data for a specific study - Get simple atomic
	 * phenotyping values - Study Locations for adaptation to climate change - Find
	 * phenotypes that are from after a certain timestamp
	 * observationTimeStampRangeStart and observationTimeStampRangeEnd use Iso
	 * Standard 8601. observationValue data type inferred from the ontology
	 *
	 * @throws ApiException if the Api call fails
	 */
Submit a search request for Observation Units
Returns a list of observationUnit with the observed Phenotypes. See Search
Services for additional implementation details. Use case - this section
allows to get a dataset from multiple studies. It allows to integrate data
from several databases.

@throws ApiException if the Api call fails
Submit a search request for Observation Units Returns a list of observationUnit with the observed Phenotypes . See Search Services for additional implementation details . Use case - this section allows to get a dataset from multiple studies . It allows to integrate data from several databases . @throws ApiException if the Api call fails
@Test
	@Order(1)
	public void searchObservationunitsPostTest() throws ApiException {
		BrAPIObservationUnitSearchRequest body = new BrAPIObservationUnitSearchRequest();
		body.addProgramDbIdsItem("1");
		ApiResponse<Pair<Optional<BrAPIObservationUnitListResponse>, Optional<BrAPIAcceptedSearchResponse>>> response = api.searchObservationunitsPost(body);
		Pair<Optional<BrAPIObservationUnitListResponse>, Optional<BrAPIAcceptedSearchResponse>> responseBody = response.getBody();
		Optional<BrAPIObservationUnitListResponse> listResponse = responseBody.getLeft();
		Optional<BrAPIAcceptedSearchResponse> searchResponse = responseBody.getRight();
		if (listResponse.isPresent()) {
			assertTrue(listResponse.get() != null, "data body was null");
			BrAPIObservationUnitListResponseResult result = listResponse.get().getResult();
			assertTrue(result.getData() != null, "No data object was returned in body");
		} else {
			assertTrue(searchResponse.get() != null, "search body was null");
			BrAPIAcceptedSearchResponse resp = searchResponse.get();
			BrAPIAcceptedSearchResponseResult result = resp.getResult();
			assertTrue(result.getSearchResultsDbId() != null, "No search id was returned in body");
			searchResultDbId = result.getSearchResultsDbId();
		}
	}
@ Test @ Order ( 1 ) public void searchObservationunitsPostTest ( ) throws ApiException { BrAPIObservationUnitSearchRequest body = new BrAPIObservationUnitSearchRequest ( ) ; body . addProgramDbIdsItem ( "1" ) ; ApiResponse < Pair < Optional < BrAPIObservationUnitListResponse > , Optional < BrAPIAcceptedSearchResponse > > > response = api . searchObservationunitsPost ( body ) ; Pair < Optional < BrAPIObservationUnitListResponse > , Optional < BrAPIAcceptedSearchResponse > > responseBody = response . getBody ( ) ; Optional < BrAPIObservationUnitListResponse > listResponse = responseBody . getLeft ( ) ; Optional < BrAPIAcceptedSearchResponse > searchResponse = responseBody . getRight ( ) ; if ( listResponse . isPresent ( ) ) { assertTrue ( listResponse . get ( ) != null , "data body was null" ) ; BrAPIObservationUnitListResponseResult result = listResponse . get ( ) . getResult ( ) ; assertTrue ( result . getData ( ) != null , "No data object was returned in body" ) ; } else { assertTrue ( searchResponse . get ( ) != null , "search body was null" ) ; BrAPIAcceptedSearchResponse resp = searchResponse . get ( ) ; BrAPIAcceptedSearchResponseResult result = resp . getResult ( ) ; assertTrue ( result . getSearchResultsDbId ( ) != null , "No search id was returned in body" ) ; searchResultDbId = result . getSearchResultsDbId ( ) ; } }
Submit a search request for Observation Units
 Returns a list of observationUnit with the observed Phenotypes.
Submit a search request for Observation Units Returns a list of observationUnit with the observed Phenotypes .
// Likely isn't going to return anything. Just testing whether search result vs data result is parsed correctly. // Check our searchResultDbId was passed