View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2013-2025 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.github.mock;
6   
7   import com.jcabi.github.Blob;
8   import com.jcabi.github.Blobs;
9   import java.io.IOException;
10  import org.hamcrest.MatcherAssert;
11  import org.hamcrest.Matchers;
12  import org.junit.jupiter.api.Test;
13  
14  /**
15   * Test case for {@link MkBlobs}.
16   * @since 0.8
17   */
18  final class MkBlobsTest {
19  
20      @Test
21      void canCreateBlob() throws IOException {
22          final Blobs blobs = new MkGitHub().randomRepo().git().blobs();
23          final Blob blob = blobs.create("content1", "encoding1");
24          MatcherAssert.assertThat(
25              "Values are not equal",
26              blobs.get(blob.sha()),
27              Matchers.equalTo(blob)
28          );
29      }
30  
31      @Test
32      void getBlob() throws IOException {
33          final Blobs blobs = new MkGitHub().randomRepo().git().blobs();
34          final Blob created =  blobs.create("content", "base64");
35          MatcherAssert.assertThat(
36              "Value is null",
37              blobs.get(created.sha()),
38              Matchers.notNullValue()
39          );
40      }
41  }