Fix CI warnings

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-02-01 16:22:03 +01:00
parent 6109496ab9
commit 91f0634c74
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
3 changed files with 59 additions and 73 deletions

View File

@ -19,5 +19,4 @@
*/
package com.nextcloud.talk.call
data class RaisedHand(val state: Boolean, val timestamp: Long) {
}
data class RaisedHand(val state: Boolean, val timestamp: Long)

View File

@ -1,71 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Daniel Calviño Sánchez
* Copyright (C) 2022 Daniel Calviño Sánchez <danxuliu@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.call;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class CallParticipantModelTest {
private MutableCallParticipantModel callParticipantModel;
private CallParticipantModel.Observer mockedCallParticipantModelObserver;
@Before
public void setUp() {
callParticipantModel = new MutableCallParticipantModel("theSessionId");
mockedCallParticipantModelObserver = mock(CallParticipantModel.Observer.class);
}
@Test
public void testSetRaisedHand() {
callParticipantModel.addObserver(mockedCallParticipantModelObserver);
callParticipantModel.setRaisedHand(true, 4815162342L);
verify(mockedCallParticipantModelObserver, only()).onChange();
}
@Test
public void testSetRaisedHandTwice() {
callParticipantModel.addObserver(mockedCallParticipantModelObserver);
callParticipantModel.setRaisedHand(true, 4815162342L);
callParticipantModel.setRaisedHand(false, 4815162342108L);
verify(mockedCallParticipantModelObserver, times(2)).onChange();
}
@Test
public void testSetRaisedHandTwiceWithSameValue() {
callParticipantModel.addObserver(mockedCallParticipantModelObserver);
callParticipantModel.setRaisedHand(true, 4815162342L);
callParticipantModel.setRaisedHand(true, 4815162342L);
verify(mockedCallParticipantModelObserver, only()).onChange();
}
}

View File

@ -0,0 +1,58 @@
/*
* Nextcloud Talk application
*
* @author Daniel Calviño Sánchez
* Copyright (C) 2022 Daniel Calviño Sánchez <danxuliu@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.call
import org.junit.Before
import org.junit.Test
import org.mockito.Mockito
class CallParticipantModelTest {
private var callParticipantModel: MutableCallParticipantModel? = null
private var mockedCallParticipantModelObserver: CallParticipantModel.Observer? = null
@Before
fun setUp() {
callParticipantModel = MutableCallParticipantModel("theSessionId")
mockedCallParticipantModelObserver = Mockito.mock(CallParticipantModel.Observer::class.java)
}
@Test
fun testSetRaisedHand() {
callParticipantModel!!.addObserver(mockedCallParticipantModelObserver)
callParticipantModel!!.setRaisedHand(true, 4815162342L)
Mockito.verify(mockedCallParticipantModelObserver, Mockito.only())?.onChange()
}
@Test
fun testSetRaisedHandTwice() {
callParticipantModel!!.addObserver(mockedCallParticipantModelObserver)
callParticipantModel!!.setRaisedHand(true, 4815162342L)
callParticipantModel!!.setRaisedHand(false, 4815162342108L)
Mockito.verify(mockedCallParticipantModelObserver, Mockito.times(2))?.onChange()
}
@Test
fun testSetRaisedHandTwiceWithSameValue() {
callParticipantModel!!.addObserver(mockedCallParticipantModelObserver)
callParticipantModel!!.setRaisedHand(true, 4815162342L)
callParticipantModel!!.setRaisedHand(true, 4815162342L)
Mockito.verify(mockedCallParticipantModelObserver, Mockito.only())?.onChange()
}
}