mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Fix tests
This commit is contained in:
		| @@ -8,8 +8,13 @@ import androidx.test.filters.LargeTest; | |||||||
| import org.junit.Test; | import org.junit.Test; | ||||||
| import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
|  | import org.schabi.newpipe.extractor.ServiceList; | ||||||
|  | import org.schabi.newpipe.extractor.exceptions.ParsingException; | ||||||
|  |  | ||||||
|  | import java.util.Arrays; | ||||||
|  |  | ||||||
| import static org.junit.Assert.assertEquals; | import static org.junit.Assert.assertEquals; | ||||||
|  | import static org.junit.Assert.assertTrue; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Instrumented tests for {@link ErrorInfo}. |  * Instrumented tests for {@link ErrorInfo}. | ||||||
| @@ -20,18 +25,21 @@ public class ErrorInfoTest { | |||||||
|  |  | ||||||
|     @Test |     @Test | ||||||
|     public void errorInfoTestParcelable() { |     public void errorInfoTestParcelable() { | ||||||
|         final ErrorInfo info = ErrorInfo.make(UserAction.USER_REPORT, "youtube", "request", |         final ErrorInfo info = new ErrorInfo(new ParsingException("Hello"), | ||||||
|                 R.string.general_error); |                 UserAction.USER_REPORT, "request", ServiceList.YouTube.getServiceId()); | ||||||
|         // Obtain a Parcel object and write the parcelable object to it: |         // Obtain a Parcel object and write the parcelable object to it: | ||||||
|         final Parcel parcel = Parcel.obtain(); |         final Parcel parcel = Parcel.obtain(); | ||||||
|         info.writeToParcel(parcel, 0); |         info.writeToParcel(parcel, 0); | ||||||
|         parcel.setDataPosition(0); |         parcel.setDataPosition(0); | ||||||
|         final ErrorInfo infoFromParcel = ErrorInfo.CREATOR.createFromParcel(parcel); |         final ErrorInfo infoFromParcel = (ErrorInfo) ErrorInfo.CREATOR.createFromParcel(parcel); | ||||||
|  |  | ||||||
|  |         assertTrue(Arrays.toString(infoFromParcel.getStackTraces()) | ||||||
|  |                 .contains(ErrorInfoTest.class.getSimpleName())); | ||||||
|         assertEquals(UserAction.USER_REPORT, infoFromParcel.getUserAction()); |         assertEquals(UserAction.USER_REPORT, infoFromParcel.getUserAction()); | ||||||
|         assertEquals("youtube", infoFromParcel.getServiceName()); |         assertEquals(ServiceList.YouTube.getServiceInfo().getName(), | ||||||
|  |                 infoFromParcel.getServiceName()); | ||||||
|         assertEquals("request", infoFromParcel.getRequest()); |         assertEquals("request", infoFromParcel.getRequest()); | ||||||
|         assertEquals(R.string.general_error, infoFromParcel.getMessageStringId()); |         assertEquals(R.string.parsing_error, infoFromParcel.getMessageStringId()); | ||||||
|  |  | ||||||
|         parcel.recycle(); |         parcel.recycle(); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox