我已经看到了这个问题的几种变体,涉及到android,powermock,bytebuddy-downloads-gone-wrong和其他可能的问题。我不认为我的问题与powermock或android有关,因为我都不使用。以下是测试类别,省略了不相关的测试。
public class TournamentsTests {
private ToornamentClient client;
private HashMap<String,String> params;
private HashMap<String,String> headers;
private TournamentRequest tournamentRequest = new TournamentRequest();
private TournamentDetails tournamentDetails = new TournamentDetails();
@Before
public void Setup() throws IOException {
client = new ToornamentClient(System.getenv("KEY"),System.getenv("CLIENT"),System.getenv("SECRET"));
client.authorize();
headers = new HashMap<>();
params = new HashMap<>();
params.put("disciplines","overwatch");
tournamentDetails.setParticipantType(ParticipantType.TEAM);
tournamentDetails.setName("OWL Season 1");
tournamentDetails.setSize(144);
tournamentDetails.setDiscipline("overwatch");
tournamentRequest.setDiscipline("overwatch");
tournamentRequest.setOrganization("Blizzard Entertainment");
tournamentRequest.setWebsite("http://www.overwatchleague.com");
tournamentRequest.setMatchFormat(MatchFormat.BO3);
tournamentRequest.setPrize("$500,000-$1,000,000");
tournamentRequest.setSize(144);
tournamentRequest.setName("OWL Season 1");
tournamentRequest.setParticipantType(ParticipantType.TEAM);
}
@AfterEach
public void CleanUp(){
headers.clear();
}
@Test
public void createTournamentTest(){
Mockito.when(client.tournaments().createTournament(tournamentRequest)).thenReturn(tournamentDetails);
}
}
Run Code Online (Sandbox Code Playgroud)
上面的单个测试是我要模拟的测试,因为它打算通过该库打算使用的api插入。我不确定powermock是否是解决方案的一部分,因为我不清楚它的作用,但是可以随时帮助我解决它。我的build.gradle文件如下所示:
group …Run Code Online (Sandbox Code Playgroud) 我在 stackoverflow 上查看了许多非常相似的问题的答案,但似乎没有什么可以解决问题。我做了很多更改并拥有大量的提交历史记录,目前我对此还算满意。一旦一切正常,我就发出了拉取请求,并且拉取请求已与我分叉的存储库合并。但我的分叉仍然比原始存储库提前了 X 次提交,而且我似乎无法重置此提交计数器。我尝试过变基、重置以及似乎我能找到的所有其他方法。但我仍然看到这个:
我怎样才能让一切恢复一致?到目前为止,我只在我自己的项目中使用过 git,而且 git 的一些设计让我感到困惑。