Skip to content

Commit

Permalink
fix: fix unit tests following upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
alicedraillard committed Dec 5, 2024
1 parent 29961f9 commit da5c5dd
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/test/java/fr/cgi/magneto/helper/IModelHelperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,4 @@ public void testSubClassIModel(TestContext ctx) {

ctx.assertTrue(invalidModel.isEmpty(), "One or more IModel don't have public constructor with JsonObject parameter declared. Check log above.");
}

@Test
public void testLinkedMap(TestContext ctx) {
LinkedHashMap<Object, Object> linkedHashMap = new LinkedHashMap<>();
LinkedHashMap<Object, Object> linkedHashMap2 = new LinkedHashMap<>();
LinkedHashMap<Object, Object> linkedHashMap3 = new LinkedHashMap<>();
LinkedHashMap<Object, Object> linkedHashMap4 = new LinkedHashMap<>();
linkedHashMap.put("my_name", "name1");
linkedHashMap2.put("my_name", "name2");
//Is instance is not a MyOtherIModel, so it will not be added to the list
linkedHashMap3.put("my_name", new MyClass());
linkedHashMap4.put(3, "name3");

List<MyOtherIModel> list = ModelHelper.toList(new JsonArray(Arrays.asList(linkedHashMap, linkedHashMap2, linkedHashMap3,
linkedHashMap4)), MyOtherIModel.class);

ctx.assertEquals(list.size(), 3);
ctx.assertEquals(list.get(0).myName, "name1");
ctx.assertEquals(list.get(1).myName, "name2");
ctx.assertEquals(list.get(2).myName, null);
}
}

0 comments on commit da5c5dd

Please sign in to comment.