1+ /*
2+ * This file is a part of project QuickShop, the name is MojangAPITest.java
3+ * Copyright (C) PotatoCraft Studio and contributors
4+ *
5+ * This program is free software: you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License as published by the
7+ * Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful, but WITHOUT
11+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+ * for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ *
18+ */
19+
20+ package org .maxgamer .quickshop .util .mojangapi ;
21+
22+ import org .junit .Assert ;
23+ import org .junit .Test ;
24+
25+ import java .util .Optional ;
26+
27+ public class MojangAPITest_MCBBSAPI {
28+ @ Test
29+ public void testMojangMetaApi () {
30+ MojangAPI api = new MojangAPI (new MojangApiMcbbsApiMirror ());
31+ Optional <String > metaData = api .getMetaAPI ("1.16.5" ).get ();
32+ Assert .assertTrue (metaData .isPresent ());
33+ Assert .assertFalse (metaData .get ().isEmpty ());
34+ }
35+
36+ @ Test
37+ public void testMojangAssetsApi () {
38+ MojangAPI api = new MojangAPI (new MojangApiMcbbsApiMirror ());
39+ MojangAPI .AssetsAPI assetsAPI = api .getAssetsAPI ("1.16.5" );
40+ Assert .assertTrue (assetsAPI .isAvailable ());
41+ Optional <MojangAPI .AssetsFileData > assetsFileData = assetsAPI .getGameAssetsFile ();
42+ Assert .assertTrue (assetsFileData .isPresent ());
43+ Assert .assertFalse (assetsFileData .get ().getContent ().isEmpty ());
44+ Assert .assertFalse (assetsFileData .get ().getId ().isEmpty ());
45+ Assert .assertFalse (assetsFileData .get ().getSha1 ().isEmpty ());
46+ }
47+ }
0 commit comments