|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2024 Obeo. |
| 2 | + * Copyright (c) 2024, 2025 Obeo. |
3 | 3 | * This program and the accompanying materials |
4 | 4 | * are made available under the terms of the Eclipse Public License v2.0 |
5 | 5 | * which accompanies this distribution, and is available at |
|
29 | 29 | */ |
30 | 30 | public class SysMLExternalResourceLoaderServiceTests { |
31 | 31 |
|
| 32 | + private static final String PACKAGE_P1 = "package p1;"; |
| 33 | + |
32 | 34 | @Test |
33 | 35 | public void testCandHandle() { |
34 | 36 | // Incorrect content |
35 | 37 | assertFalse(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream("{}".getBytes()), URI.createFileURI("/test/model.sysml"), new ResourceSetImpl())); |
36 | 38 | // Incorrect extension |
37 | | - assertFalse(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream("package p1;".getBytes()), URI.createFileURI("/test/model.sysml2"), |
| 39 | + assertFalse(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.sysml2"), |
| 40 | + new ResourceSetImpl())); |
| 41 | + // Valid file |
| 42 | + assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.sysml"), |
| 43 | + new ResourceSetImpl())); |
| 44 | + // Valid file |
| 45 | + assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.kerml"), |
| 46 | + new ResourceSetImpl())); |
| 47 | + // Valid file |
| 48 | + assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.SYSML"), |
| 49 | + new ResourceSetImpl())); |
| 50 | + // Valid file |
| 51 | + assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.KERML"), |
| 52 | + new ResourceSetImpl())); |
| 53 | + // Valid file |
| 54 | + assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.SysML"), |
38 | 55 | new ResourceSetImpl())); |
39 | 56 | // Valid file |
40 | | - assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream("package p1;".getBytes()), URI.createFileURI("/test/model.sysml"), |
| 57 | + assertTrue(new SysMLExternalResourceLoaderService(new SysmlToAst(null)).canHandle(new ByteArrayInputStream(PACKAGE_P1.getBytes()), URI.createFileURI("/test/model.KerML"), |
41 | 58 | new ResourceSetImpl())); |
42 | 59 | } |
43 | 60 |
|
|
0 commit comments