From 91f0634c74e7e05691543c777baffbadeab659ed Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 1 Feb 2023 16:22:03 +0100 Subject: [PATCH] Fix CI warnings Signed-off-by: Marcel Hibbe --- .../com/nextcloud/talk/call/RaisedHand.kt | 3 +- .../talk/call/CallParticipantModelTest.java | 71 ------------------- .../talk/call/CallParticipantModelTest.kt | 58 +++++++++++++++ 3 files changed, 59 insertions(+), 73 deletions(-) delete mode 100644 app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.java create mode 100644 app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.kt diff --git a/app/src/main/java/com/nextcloud/talk/call/RaisedHand.kt b/app/src/main/java/com/nextcloud/talk/call/RaisedHand.kt index 20d12b854..7a07fb337 100644 --- a/app/src/main/java/com/nextcloud/talk/call/RaisedHand.kt +++ b/app/src/main/java/com/nextcloud/talk/call/RaisedHand.kt @@ -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) diff --git a/app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.java b/app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.java deleted file mode 100644 index 059f7b700..000000000 --- a/app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Daniel Calviño Sánchez - * Copyright (C) 2022 Daniel Calviño Sánchez - * - * 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 . - */ -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(); - } -} diff --git a/app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.kt b/app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.kt new file mode 100644 index 000000000..efba5bd4e --- /dev/null +++ b/app/src/test/java/com/nextcloud/talk/call/CallParticipantModelTest.kt @@ -0,0 +1,58 @@ +/* + * Nextcloud Talk application + * + * @author Daniel Calviño Sánchez + * Copyright (C) 2022 Daniel Calviño Sánchez + * + * 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 . + */ +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() + } +}