Skip to content

Commit

Permalink
Changes JUnit 4 to JUnit 4 and updates all tests
Browse files Browse the repository at this point in the history
to use the new annotations and requirements
instead of using JUnit Vintage.

See https://www.baeldung.com/junit-5-migration

Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
  • Loading branch information
manoelcampos committed Oct 20, 2018
1 parent dd7de81 commit a4a0c5b
Show file tree
Hide file tree
Showing 60 changed files with 824 additions and 795 deletions.
2 changes: 1 addition & 1 deletion cloudsim-plus-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.cloudsimplus</groupId>
<artifactId>cloudsim-plus-benchmarks</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
<name>CloudSim Plus Benchmarks</name>
<description>A module containing benchmarks created using JMH (Java Microbenchmark Harness framework) to assess CloudSim Plus performance</description>
<url>http://cloudsimplus.org</url>
Expand Down
2 changes: 1 addition & 1 deletion cloudsim-plus-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.cloudsimplus</groupId>
<artifactId>cloudsim-plus-examples</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
<name>CloudSim Plus Examples</name>
<description>
Ready-to-run examples of how to use CloudSim Plus API.
Expand Down
2 changes: 1 addition & 1 deletion cloudsim-plus-testbeds/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.cloudsimplus</groupId>
<artifactId>cloudsim-plus-testbeds</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
<name>CloudSim Plus Testbeds</name>
<description>
A set of more complex and comprehensive CloudSim Plus testbeds used to assess
Expand Down
15 changes: 10 additions & 5 deletions cloudsim-plus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.cloudsimplus</groupId>
<artifactId>cloudsim-plus</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
<name>CloudSim Plus API</name>
<description>CloudSim Plus: A modern, highly extensible and easier-to-use Java 8 Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services</description>
<url>http://cloudsimplus.org</url>
Expand Down Expand Up @@ -424,11 +424,10 @@
<type>jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
Expand All @@ -452,6 +451,12 @@
<artifactId>powermock-module-junit4</artifactId>
<version>1.7.3</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class CloudSim implements Simulation {
/**
* CloudSim Plus current version.
*/
public static final String VERSION = "4.0.3";
public static final String VERSION = "4.0.4";

private static final Logger LOGGER = LoggerFactory.getLogger(CloudSim.class.getSimpleName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import org.cloudbus.cloudsim.vms.Vm;
import org.cloudbus.cloudsim.vms.VmTestUtil;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
* @author Manoel Campos da Silva Filho
Expand All @@ -27,7 +27,7 @@ public class VmAllocationPolicySimpleTest {
public static final int HOST_BASE_STORAGE = 1000;
private VmAllocationPolicySimple policy;

@Before
@BeforeEach
public void setUp(){
policy = createVmAllocationPolicy(4, 2, 6, 5);
}
Expand Down Expand Up @@ -77,7 +77,7 @@ public void allocateHostForVm_WhenOneVmIsGivenAndSelectedHostDoesntHaveStorage_A
final Vm vm = VmTestUtil.createVm(
0, 1000, 2, 1, 1,
HOST_BASE_STORAGE, CloudletScheduler.NULL);
assertTrue(vm + " couldn't be allocated to " + hostWithMoreFreePes, policy.allocateHostForVm(vm));
assertTrue(policy.allocateHostForVm(vm), vm + " couldn't be allocated to " + hostWithMoreFreePes);

final Host allocatedHostForVm = vm.getHost();
assertEquals(hostWithMoreFreePes, allocatedHostForVm);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package org.cloudbus.cloudsim.cloudlets;

import org.cloudbus.cloudsim.utilizationmodels.UtilizationModelStochastic;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

import static org.cloudbus.cloudsim.cloudlets.CloudletSimpleTest.PES_NUMBER;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
* @author Anton Beloglazov
Expand All @@ -23,7 +24,7 @@ public class CloudletSimpleFilesTest {

private CloudletSimple cloudlet;

@Before
@BeforeEach
public void setUp() {
cloudlet = new CloudletSimple(0, CloudletTestUtil.CLOUDLET_LENGTH, PES_NUMBER);
cloudlet.setFileSize(CloudletTestUtil.CLOUDLET_FILE_SIZE)
Expand All @@ -38,10 +39,8 @@ public void testAddRequiredFile() {
final CloudletSimple cloudlet = CloudletTestUtil.createCloudlet();
final String files[] = {FILE1, FILE2};
for (final String file : files) {
assertTrue("Method file should be added",
cloudlet.addRequiredFile(file)); //file doesn't previously added
assertFalse("Method file shouldn't be added",
cloudlet.addRequiredFile(file)); //file already added
assertTrue(cloudlet.addRequiredFile(file), "file should be added"); //file doesn't previously added
assertFalse(cloudlet.addRequiredFile(file), "file shouldn't be added"); //file already added
}
}

Expand All @@ -68,10 +67,10 @@ public void testSetRequiredFiles0() {
assertEquals(files, cloudlet.getRequiredFiles());
}

@Test(expected = NullPointerException.class)
@Test()
public void testRequiredFiles1() {
final CloudletSimple cloudlet = CloudletTestUtil.createCloudlet();
cloudlet.setRequiredFiles(null);
Assertions.assertThrows(NullPointerException.class, () -> cloudlet.setRequiredFiles(null));
assertNotNull(cloudlet.getRequiredFiles());
}

Expand Down

0 comments on commit a4a0c5b

Please sign in to comment.