This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Golf where | |
| import Data.List | |
| every n xs = case drop (n-1) xs of | |
| (y:ys) -> y:every n ys | |
| [] -> [] | |
| skips :: [a] -> [[a]] | |
| skips xs = map (\n -> every n xs) [1..length xs] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| frequencies :: [Integer] -> [(Integer, Int)] | |
| frequencies xs = map (\x -> (head x, length x)) . group . sort $ xs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Golf where | |
| import Data.List | |
| import Data.Text (justifyRight, pack, unpack) | |
| import Data.Ord (comparing) | |
| -- ex 1 | |
| skips :: [a] -> [[a]] | |
| skips xs = map (flip every xs) [1..length xs] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) Error mapping com.google.gson.JsonObject to org.me.modelmappertest.Foo | |
| 1 error | |
| at org.modelmapper.internal.Errors.throwMappingExceptionIfErrorsExist(Errors.java:374) | |
| at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:69) | |
| at org.modelmapper.ModelMapper.mapInternal(ModelMapper.java:497) | |
| at org.modelmapper.ModelMapper.map(ModelMapper.java:340) | |
| at org.me.modelmappertest.TestGsonMapper.main(TestGsonMapper.java:31) | |
| Caused by: java.lang.NullPointerException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.me.modelmapper; | |
| import com.fasterxml.jackson.databind.JsonNode; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import java.util.ArrayList; | |
| import org.modelmapper.ModelMapper; | |
| import org.modelmapper.config.Configuration; | |
| import org.modelmapper.jackson.JsonNodeValueReader; | |
| import org.testng.Assert; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>org.me.modelmappertest</groupId> | |
| <artifactId>modelMapperTest</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <packaging>jar</packaging> | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.modelmapper</groupId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ------------------------------------------------------- | |
| T E S T S | |
| ------------------------------------------------------- | |
| Running org.me.modelmapper.JsonModelMapperTest | |
| Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@5704ce99 | |
| Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.921 sec <<< FAILURE! | |
| shouldMapFromJsonNode(org.me.modelmapper.JsonModelMapperTest) Time elapsed: 0.336 sec <<< FAILURE! | |
| org.modelmapper.MappingException: ModelMapper mapping errors: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * To change this license header, choose License Headers in Project Properties. | |
| * To change this template file, choose Tools | Templates | |
| * and open the template in the editor. | |
| */ | |
| package org.me.modelmapper; | |
| import com.fasterxml.jackson.databind.JsonNode; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import com.google.gson.JsonElement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@60acc399 | |
| Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.326 sec <<< FAILURE! | |
| shouldMapHashMapToFoo(org.me.modelmapper.JsonModelMapperTest) Time elapsed: 0.186 sec <<< FAILURE! | |
| org.modelmapper.ConfigurationException: ModelMapper configuration errors: | |
| 1) Invalid source method java.util.HashMap.get(). Ensure that method has zero parameters and does not return void. | |
| 2) Invalid source method java.util.HashMap.get(). Ensure that method has zero parameters and does not return void. | |
| 2 errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def foo-parser | |
| (insta/parser | |
| "grammar = foo | other | |
| foo = 'FOO' | |
| other = !foo" | |
| :auto-whitespace :standard)) | |