assertEquals("Message has been sent", getString(notification, EXTRA_BIG_TEXT)); assertTrue( getString(notification, EXTRA_TEXT) .contains("Kurt Kluever <kak@google.com>"));
assertThat(getString(notification, EXTRA_BIG_TEXT)) .isEqualTo("Message has been sent"); assertThat(getString(notification, EXTRA_TEXT)) .contains("Kurt Kluever <kak@google.com>");
java.lang.AssertionError: Expecting: <[year: 2019 month: 7 day: 15 ]> to contain exactly in any order: <[year: 2019 month: 6 day: 30 ]> elements not found: <[year: 2019 month: 6 day: 30 ]> and elements not expected: <[year: 2019 month: 7 day: 15 ]>
value of: iterable.onlyElement() expected: year: 2019 month: 6 day: 30 but was: year: 2019 month: 7 day: 15
assertThat(notification).extras().string(EXTRA_BIG_TEXT) .isEqualTo("Message has been sent"); assertThat(notification).extras().string(EXTRA_TEXT) .contains("Kurt Kluever <kak@google.com>");
@Test public void uploadFileToCloudStorage() { when(mockCloudService.write( WriteRequest.newBuilder().setUserId(“testuser”).setFileType(“plain/text”)...)) .thenReturn(WriteResponse.newBuilder().setUploadId(“uploadId”).build()); CloudUploader cloudUploader = new CloudUploader(mockCloudService); Uri uri = cloudUploader.uploadFile(new File(“/path/to/foo.txt”)); // The uploaded file URI contains the user ID, file type, and upload ID. (Or does it?) assertThat(uri).isEqualTo(new Uri(“/testuser/text/uploadId.txt”));
@Test public void uploadFileToCloudStorage() { CloudUploader cloudUploader = new CloudUploader(cloudService); Uri uri = cloudUploader.uploadFile(”/path/to/foo.txt”); assertThat(cloudService.retrieveFile(uri)).isEqualTo(readContent(“/path/to/foo.txt")); }
class Vector { explicit Vector(int num_slots); // Creates an empty vector with `num_slots` slots. int RemainingSlots() const; // Returns the number of currently remaining slots. void AddSlots(int num_slots); // Adds `num_slots` more slots to the vector. // Adds a new element at the end of the vector. Caller must ensure that RemainingSlots() // returns at least 1 before calling this, otherwise caller should call AddSlots(). void Insert(int value); }
class Vector { explicit Vector(int num_slots); // Adds a new element at the end of the vector. If necessary, // allocates new slots to ensure that there is enough storage // for the new value. void Insert(int value); }