Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class BridgeCreateEventTest {
@Test
void shouldCreateEvent() {
//given
BridgeCreateEvent bridgeCreateEvent = new BridgeCreateEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("bridgevideosourcemode", "none");

//when
setAttributes(bridgeCreateEvent, attributes, new HashSet<>());

//then
assertThat(bridgeCreateEvent.getBridgevideosourcemode()).isNull();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class BridgeEnterEventTest {
@Test
void shouldCreateEvent() {
//given
BridgeEnterEvent bridgeEnterEvent = new BridgeEnterEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("swapuniqueid", "GW1-1517402850.50086");

//when
setAttributes(bridgeEnterEvent, attributes, new HashSet<>());

//then
assertThat(bridgeEnterEvent.getSwapuniqueid()).isEqualTo("GW1-1517402850.50086");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class ConfbridgeJoinEventTest {
@Test
void shouldCreateEvent() {
//given
ConfbridgeJoinEvent confbridgeJoinEvent = new ConfbridgeJoinEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("language", "en");
attributes.put("linkedid", "1474881412.1");

//when
setAttributes(confbridgeJoinEvent, attributes, new HashSet<>());

//then
assertThat(confbridgeJoinEvent.getLanguage()).isEqualTo("en");
assertThat(confbridgeJoinEvent.getLinkedId()).isEqualTo("1474881412.1");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class ConfbridgeLeaveEventTest {
@Test
void shouldCreateEvent() {
//given
ConfbridgeLeaveEvent confbridgeLeaveEvent = new ConfbridgeLeaveEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("language", "en");
attributes.put("linkedid", "1475486824.3");

//when
setAttributes(confbridgeLeaveEvent, attributes, new HashSet<>());

//then
assertThat(confbridgeLeaveEvent.getLanguage()).isEqualTo("en");
assertThat(confbridgeLeaveEvent.getLinkedId()).isEqualTo("1475486824.3");
}
}
43 changes: 43 additions & 0 deletions src/test/java/org/asteriskjava/manager/event/HangupEventTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class HangupEventTest {
@ParameterizedTest
@ValueSource(strings = {"False", "762377"})
void shouldCreateEvent(String accountCode) {
//given
HangupEvent hangupEvent = new HangupEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("accountcode", accountCode);

//when
setAttributes(hangupEvent, attributes, new HashSet<>());

//then
assertThat(hangupEvent.getAccountCode()).isEqualTo(accountCode);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class HangupRequestEventTest {
@Test
void shouldCreateEvent() {
//given
HangupRequestEvent hangupRequestEvent = new HangupRequestEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("cause", "1");

//when
setAttributes(hangupRequestEvent, attributes, new HashSet<>());

//then
assertThat(hangupRequestEvent.getCause()).isEqualTo(1);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asteriskjava.manager.event;

import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.HashSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes;

class MusicOnHoldEventTest {
@Test
void shouldCreateEvent() {
//given
MusicOnHoldEvent musicOnHoldEvent = new MusicOnHoldEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("class", "default");

//when
setAttributes(musicOnHoldEvent, attributes, new HashSet<>());

//then
assertThat(musicOnHoldEvent.getClassName()).isEqualTo("default");
}
}